pthreads-win32 and Coverity

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pthreads-win32 and Coverity

Robert Kindred
Everyone:

   Has anyone on this mailing list heard of Coverity?  I
am evaluating it in a desperate attempt to find a bug in
my code.  When I run it in debug mode, nothing breaks.  When
my program runs in release mode, it gets an access violation
after a couple of days running, which could be anything.
Anyway, one of the things Coverity uncovered is called
FORWARD NULL.  Here is an example below from ptw32_throw.c,
line 84:

Event var_compare_op: Added "sp" due to comparison "sp == 0"
At conditional (1): "sp == 0" taking true path
68    if (NULL == sp || sp->implicit)
69      {
70        /*
71         * We're inside a non-POSIX initialised Win32 thread
72         * so there is no point to jump or throw back to. Just do an
73         * explicit thread exit here after cleaning up POSIX
74         * residue (i.e. cleanup handlers, POSIX thread handle etc).
75         */
76        unsigned exitCode = 0;
77  
78        switch (exception)
79   {
80   case PTW32_EPS_CANCEL:
81    exitCode = (unsigned) PTHREAD_CANCELED;
82    break;
At conditional (2): "exception == 1" taking true path
83   case PTW32_EPS_EXIT:
Event var_deref_op: Variable "sp" tracked as NULL was dereferenced.
84    exitCode = (unsigned) sp->exitStatus;;
85    break;
86   }

In other words, if sp shows to be null at line 68, it should not be
dereferenced at line 84.  I can show some others, but I am not sure
if they are significant.

Let me know what you think,

Robert Kindred