Bug#748549: Unchecked conversion from float to enum

Michael Tautschnig mt at debian.org
Sun May 18 10:45:08 UTC 2014


Package: ioquake3
Version: 1.36+u20140319+gb099255-1
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.

[...]
cc  -DDEDICATED -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fsigned-char -DWITH_OPENARENA -D_FORTIFY_SOURCE=2 -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe -DUSE_ICON -DDEFAULT_BASEDIR=\"/usr/lib/ioquake3\" -DPRODUCT_VERSION=\"1.36+u20140319+gb099255-1/Debian\" -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral -Wstrict-aliasing=2 -Wmissing-format-attribute -Wdisabled-optimization -Werror-implicit-function-declaration -MMD -DUSE_VOIP -DNDEBUG -O3 -fomit-frame-pointer -funroll-loops -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fstrength-reduce -ffast-math -o build/ded/sv_game.o -c code/server/sv_game.c

file code/server/sv_game.c line 934 function SV_InitGameProgs: in expression `Cvar_VariableValue("vm_game")':
conversion from `float' to `int': implicit conversion not permitted
CONVERSION ERROR
Makefile:2582: recipe for target 'build/ded/sv_game.o' failed
make[4]: *** [build/ded/sv_game.o] Error 64
make[4]: Leaving directory '/srv/jenkins-slave/workspace/sid-goto-cc-ioquake3/ioquake3-1.36+u20140319+gb099255'
Makefile:1232: recipe for target 'targets' failed

Considering the definition of Cvar_VariableValue here:

http://sources.debian.net/src/ioquake3/1.36+u20140319+gb099255-1/code/qcommon/cvar.c?hl=105#L105

and the expected vmInterpret_t here:

http://sources.debian.net/src/ioquake3/1.36+u20140319+gb099255-1/code/qcommon/vm.c?hl=623,624#L623

declared here:

http://sources.debian.net/src/ioquake3/1.36+u20140319+gb099255-1/code/qcommon/qcommon.h?hl=336#L332

the conversion of the return value of Cvar_VariableValue appears to be dangerous
at best: if a float value is return that does not result in any of the int
values 0, 1, 2 all further code may break.

This implicit conversion should be made explicit, making sure the value is one
of the 3 expected ones.

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/20140518/6c3da967/attachment.sig>


More information about the Pkg-games-devel mailing list