mpiutil.c: potential null pointer dereferences
Closed, ResolvedPublic

Description

I belive an assert() can be used below and Clang will deduce the mpi is never
NULL. See http://clang-analyzer.llvm.org/faq.html.

The assert() will not be present in production builds because NDEBUG will be
defined.

libtool: compile: /usr/local/bin/scan-build/ccc-analyzer -DHAVE_CONFIG_H -I.
-I.. -I../src -I../src -I/usr/local/include -g3 -O1 -fvisibility=hidden -Wall
-MT mpiutil.lo -MD -MP -MF .deps/mpiutil.Tpo -c mpiutil.c -o mpiutil.o

mpiutil.c:203:13: warning: Access to field 'nlimbs' results in a dereference of
a null pointer (loaded from variable 'a')

a->nlimbs = 0;
~         ^

mpiutil.c:389:11: warning: Access to field 'sign' results in a dereference of a
null pointer (loaded from variable 'w')

w->sign = !u->sign;
~       ^

mpiutil.c:403:11: warning: Access to field 'sign' results in a dereference of a
null pointer (loaded from variable 'w')

w->sign = 0;
~       ^

3 warnings generated.

Details

Version
1.6.3
JW set Version to 1.6.3.
JW added a subscriber: JW.
werner added a subscriber: werner.Mar 10 2015, 9:32 AM

No c+p of warnings please! Use gnupg-devel for such things.

werner closed this task as Resolved.Mar 10 2015, 9:33 AM
werner claimed this task.
werner added a project: Mistaken.