[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#749803: openslp-dfsg: Conflicting declarations of function SLPDPredicateTest cause undefined behaviour



Hi!

On Thu, 2014-05-29 at 22:18:22 +0100, Michael Tautschnig wrote:
> Package: openslp-dfsg
> Version: 1.2.1-9
> 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.
> 
> [...]
> /bin/bash ../libtool  --tag=CC   --mode=link x86_64-linux-gnu-gcc  -DNDEBUG -D_REENTRANT=1  -DLINUX -Wall -O3   -o testslpd_predicate_test slpd_predicate_test.o ../libslp/libslp.la ../libslpattr/libslpattr.la ../common/libcommonlibslp.la ../common/libcommonslpd.la ../slpd/slpd_predicate.o ../common/libcommonslpd.la -lnsl -lresolv 
> libtool: link: x86_64-linux-gnu-gcc -DNDEBUG -D_REENTRANT=1 -DLINUX -Wall -O3 -o .libs/testslpd_predicate_test slpd_predicate_test.o ../slpd/slpd_predicate.o  ../libslp/.libs/libslp.so ../libslpattr/.libs/libslpattr.a ../common/.libs/libcommonlibslp.a ../common/.libs/libcommonslpd.a -lnsl -lresolv
> 
> error: conflicting function declarations "SLPDPredicateTest"
> old definition in module slpd_predicate_test file SLPD_predicate_test/slpd_predicate_test.c line 9
> signed int (void *, void *)
> new definition in module slpd_predicate file slpd_predicate.c line 1455
> signed int (signed int version, signed int attrlistlen, const char *attrlist, signed int predicatelen, const char *predicate)
> Makefile:637: recipe for target 'testslpd_predicate_test' failed
> make[3]: *** [testslpd_predicate_test] Error 64
> make[3]: Leaving directory '/srv/jenkins-slave/workspace/sid-goto-cc-openslp-dfsg/openslp-dfsg-1.2.1/test'
> Makefile:396: recipe for target 'all-recursive' failed
> make[2]: *** [all-recursive] Error 1
> 
> It seems that the following declaration should simply gain a "static" to make
> sure it is only visible within slpd_predicate_test.c, which is the only file
> using the function with such a signature:
> 
> http://sources.debian.net/src/openslp-dfsg/1.2.1-9/test/SLPD_predicate_test/slpd_predicate_test.c?hl=9#L9
> 
> The proper global one indeed has a completely different signature:
> 
> http://sources.debian.net/src/openslp-dfsg/1.2.1-9/slpd/slpd_predicate.h?hl=60#L60
> 
> Having the linker mix them has completely undefined behaviour.

Actually this seems to be worse, there are no two different function
definitions, just a single implementation with two conflicting
declarations. So to fix this correctly the test suite needs to be
changed to use the proper function signatures.

I've not included a fix for this in the upload as I was not entirely
sure if the above was the correct fix, and the test suite is not used
at all anyway.

Thanks,
Guillem


Reply to: