Bug#748418: Conflicting declaration may cause undefined behaviour

Michael Tautschnig mt at debian.org
Fri May 16 23:47:58 UTC 2014


Package: dd2
Version: 0.2.2-2
Usertags: goto-cc

During a rebuild of all packages in a clean sid chroot (and cowbuilder+pbuilder)
the build failed with the following error. Please note that we use our research
compiler tool-chain (using tools from the cbmc package), which permits extended
reporting on type inconsistencies at link time.

[...]
x86_64-linux-gnu-gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dodgindiamond2\" -DVERSION=\"0.2.2\" -DHAVE_LIBM=1 -DHAVE_LIBSDL_MIXER=1 -I.   -D_FORTIFY_SOURCE=2 -DDD2_DATA=\"/usr/share/games/dodgindiamond2\" -Wall -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DALT_FIRE -c -o main.o main.c
x86_64-linux-gnu-gcc -DDD2_DATA=\"/usr/share/games/dodgindiamond2\" -Wall -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DALT_FIRE  -fPIE -pie -Wl,-z,relro -Wl,-z,now -o dd2 menu.o SDL_plus.o cfg.o engine.o control.o main.o  -lSDL_mixer -lm  -L/usr/lib/x86_64-linux-gnu -lSDL

file engine.c line 33: error: conflicting array sizes for variable "efx"
old definition in module menu file menu.c line 31
struct Mix_Chunk *[8l]
new definition in module engine file engine.c line 33
struct Mix_Chunk *[2l]
make[3]: *** [dd2] Error 64
make[3]: Leaving directory `/srv/jenkins-slave/workspace/sid-goto-cc-dd2/dd2-0.2.2/src'
make[2]: *** [all-recursive] Error 1

The problem here is that the declaration in engine.c is just wrong (outdated?):

http://sources.debian.net/src/dd2/0.2.2-2/src/engine.c?hl=33#L33

as all other code appears to assume 8 elements, including the remaining code in
engine.c:

http://sources.debian.net/src/dd2/0.2.2-2/src/engine.c?hl=330,331#L330

Yet such code has undefined behaviour, as the compiler may assume this
constitutes and invalid memory access.

Best,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20140517/b344d435/attachment.sig>


More information about the Pkg-games-devel mailing list