-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misaligned memory accesses in marshal_2c_int and marshal_2lua_int #289
Comments
What exactly do you mean? I tried the following: diff --git a/lgi/Makefile b/lgi/Makefile
index 08419bd..d48396f 100644
--- a/lgi/Makefile
+++ b/lgi/Makefile
@@ -12,14 +12,14 @@ LUA_LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
LUA_SHAREDIR = $(PREFIX)/share/lua/$(LUA_VERSION)
PKG_CONFIG = pkg-config
-GINAME = gobject-introspection-1.0
+GINAME = gobject-introspection-1.0 lua5.3
PKGS = $(GINAME) gmodule-2.0 libffi
VERSION_FILE = version.lua
ifneq ($(filter cygwin% msys% mingw%, $(HOST_OS)),)
CORE = corelgilua51.dll
LIBFLAG = -shared
-LIBS += -llua
+LIBS += -llua5.3 -fsanitize=undefined
else
ifeq ($(HOST_OS),darwin)
CORE = corelgilua51.so
@@ -37,7 +37,7 @@ OBJS = buffer.o callable.o core.o gi.o marshal.o object.o record.o
ifndef CFLAGS
ifndef COPTFLAGS
-CFLAGS = -Wall -Wextra -O2 -g
+CFLAGS = -Wall -Wextra -O2 -g -fsanitize=undefined
endif
endif
ifeq ($(HOST_OS),darwin)
@@ -45,7 +45,7 @@ CFLAGS += -DGOBJECT_INTROSPECTION_LIBDIR=\"$(GOBJECT_INTROSPECTION_LIBDIR)\"
endif
ALL_CFLAGS = $(CCSHARED) $(COPTFLAGS) $(LUA_CFLAGS) $(shell $(PKG_CONFIG) --cflags $(PKGS)) $(CFLAGS)
LIBS += $(shell $(PKG_CONFIG) --libs $(PKGS))
-ALL_LDFLAGS = $(LIBFLAG) $(LDFLAGS)
+ALL_LDFLAGS = $(LIBFLAG) $(LDFLAGS) -fsanitize=undefined
DEPCHECK = .depcheck
# Precondition check
diff --git a/tests/Makefile b/tests/Makefile
index f11c20e..280ced0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -25,18 +25,18 @@ CCSHARED = -fPIC
endif
endif
-PKGS = gio-2.0 cairo cairo-gobject gobject-introspection-1.0 gmodule-2.0 libffi
-LUA = lua
+PKGS = gio-2.0 cairo cairo-gobject gobject-introspection-1.0 gmodule-2.0 libffi lua5.3
+LUA = lua5.3
PKG_CONFIG = pkg-config
ifndef CFLAGS
ifndef COPTFLAGS
-CFLAGS = -Wall -g
+CFLAGS = -Wall -g -fsanitize=undefined
endif
endif
ALL_CFLAGS = $(CCSHARED) $(COPTFLAGS) $(LUA_CFLAGS) $(shell $(PKG_CONFIG) --cflags $(PKGS)) $(CFLAGS) -I .
LIBS += $(shell $(PKG_CONFIG) --libs $(PKGS))
-ALL_LDFLAGS = $(LIBFLAG) $(LDFLAGS)
+ALL_LDFLAGS = $(LIBFLAG) $(LDFLAGS) -fsanitize=undefined
DEPCHECK = .depcheck
# Precondition check Result of
|
I managed to get a
The misaligned pointer comes from here: Lines 412 to 416 in 4a12286
So, the code is creating something like |
The UBSan suppression file that I added in the CI migration PR contains two entries:
lgi/.github/ubsan.supp
Lines 1 to 3 in 7ea9a48
These instances of UB should be fixed, and the file removed. (I attempted to do so in the first place, when doing the migration, but it was taking too long.)
The text was updated successfully, but these errors were encountered: