Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at lpvmgen.c:3072

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2806.2866
Procedure: bubble
Trace: View
Modified: Wed Sep 2 12:47:39 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /u1/paul/SATE/2010/c/pvm/pvm3/src/lpvmgen.c
   Enter pvm_spawn
 3141 pvm_spawn(file, argv, flags, where, count, tids) 
 3142         char *file;
 3143         char **argv;
 3144         int flags;
 3145         char *where;
 3146         int count;
 3147         int *tids;
 3148 {
 3149         int sbf, rbf;   /* temp for current tx, rx msgs */ 
 3150         int ictx;
 3151         int cc;
 3152         int i, n;
 3153         char **ep;
 3154         int *tidlist = 0;
 3155         char *p;
 3156         char buf[TEV_MASK_LENGTH + 20];
 3157         TEV_DECLS 
 3158  
 3159         if (p = getenv("PVMTASK"))
 3160                 i = pvmstrtoi(p) | flags;
 3161         else 
 3162                 i = flags;
 3163  
 3164         if (TEV_EXCLUSIVE) {
 3165                 if (TEV_DO_TRACE(TEV_SPAWN,TEV_EVENT_ENTRY)) {
 3166                         TEV_PACK_STRING( TEV_DID_SE, TEV_DATA_SCALAR,
 3167                                 file ? file : "", 1, 1 );
 3168                         TEV_PACK_STRING( TEV_DID_SW, TEV_DATA_SCALAR,
 3169                                 where ? where : "", 1, 1 );
 3170                         TEV_PACK_INT( TEV_DID_SF, TEV_DATA_SCALAR, &i, 1, 1 );
 3171                         TEV_PACK_INT( TEV_DID_SC, TEV_DATA_SCALAR, &count, 1, 1 );
 3172                         TEV_FIN;
 3173                 }
 3174         }
 3175  
 3176         if (!(cc = BEATASK)) {
 3177                 if (count < 1)
 3178                         cc = PvmBadParam;
 3179  
 3180                 else {
 3181                         sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
 3182                         rbf = pvm_setrbuf(0);
 3183  
 3184                         pvm_pkstr(file);
 3185                         pvm_pkint(&i, 1, 1);
 3186                         pvm_pkstr(where ? where : "");
 3187                         pvm_pkint(&count, 1, 1);
 3188                         if (argv)
 3189                                 for (n = 0; argv[n]; n++);
 3190                         else 
 3191                                 n = 0;
 3192                         pvm_pkint(&n, 1, 1);
 3193                         for (i = 0; i < n; i++)
 3194                                 pvm_pkstr(argv[i]);   /* Null Pointer Dereference (ID: 2809.2869) */
 3195  
 3196                         pvm_pkint( &(pvmctrc.outtid), 1, 1 );
 3197                         pvm_pkint( &(pvmctrc.outctx), 1, 1 );
 3198                         pvm_pkint( &(pvmctrc.outtag), 1, 1 );
 3199                         pvm_pkint( &(pvmctrc.trctid), 1, 1 );
 3200                         pvm_pkint( &(pvmctrc.trcctx), 1, 1 );
 3201                         pvm_pkint( &(pvmctrc.trctag), 1, 1 );
 3202  
 3203                         n = pvmgetenvars(&ep) + 4;   /* Leak (ID: 2804.2864) */
 3204                         pvm_pkint(&n, 1, 1);
 3205                         n -= 4;
 3206                         sprintf(buf, "PVMTMASK=%s", pvmctrc.tmask);
 3207                         pvm_pkstr(buf);
 3208                         sprintf(buf, "PVMTRCBUF=%d", pvmctrc.trcbuf);
 3209                         pvm_pkstr(buf);
 3210                         sprintf(buf, "PVMTRCOPT=%d", pvmctrc.trcopt);
 3211                         pvm_pkstr(buf);
 3212                         sprintf(buf, "PVMCTX=0x%x", pvmmyctx);
 3213                         pvm_pkstr(buf);
 3214                         if (n > 0) {
 3215                                 for (i = 0; i < n; i++)
 3216                                         pvm_pkstr(ep[i]);   /* Uninitialized Variable (ID: 2808.2868) */
 3217                                 PVM_FREE(ep);
 3218                         }
 3219  
 3220                         if (pvmschedtid)
 3221                                 cc = msendrecv(pvmschedtid, SM_SPAWN, PvmBaseContext);
 3222                         else 
 3223                                 cc = msendrecv(TIDPVMD, TM_SPAWN, SYSCTX_TM);
 3224                         if (cc > 0) {
 3225                                 pvm_upkint(&cc, 1, 1);
 3226                                 if (cc == count) {
true3227                                         tidlist = tids ? tids : TALLOC(count, int, "xxx");
 3228                                         pvm_upkint(tidlist, cc, 1);
tidlist <= 40953229                                         cc = bubble(cc, tidlist);
     Enter pvm_spawn / bubble
$param_2 <= 40953065   bubble(n, a) 
 3066           int n;                  /* length of a */ 
 3067           int *a;
 3068   {
 3069           int r, w, t;
 3070    
 3071           for (w = r = 0; r < n; r++) {
a <= 40953072                   if (a[w] < 0) {     /* Null Pointer Dereference */
     Exit pvm_spawn / bubble
Preconditions
$param_1 != 0
$param_2 = 0
$param_4 != 0
$param_6 = 0
&$unknown_1993325 >= 1
&$unknown_1993350 >= 2
&$unknown_1993352 != 0
&$unknown_1993366 >= 1
&$unknown_1993367 != 0
pvmautoerr != 0
pvmautoerr != 2
pvmautoerr != 3
pvmmytid != -1
pvmtoplvl != 0
pvmtrc.trctid != pvmmytid
pvmtrc.trctid >= 1
pvmtrc.trcopt <= 3
pvmtrc.trcopt >= 1
$input_12 >= 1
Postconditions
a' = 0
argv' = $param_2
cc' = &$unknown_1993325
count' = &$unknown_1993325
ep' = &$heap_187984
file' = $param_1
flags' = $param_3
$heap_187984' = &$heap_187985 - 11
bytes_after(&$heap_187984)' = 40
$heap_187984' is allocated by malloc
$heap_187984' is freed
bytes_before(&$heap_187984)' = 0
$heap_187985' = 58
bytes_after(&$heap_187985)' = $input_12 + 1
$heap_187985' is allocated by malloc
$heap_187985' is a non-heap object
bytes_before(&$heap_187985)' = 0
strlen(&$heap_187985)' = $input_12
i' = &$unknown_1993350
n' = &$unknown_1993350
n' = &$unknown_1993325
p' = 0
pvmampushed' = 0
pvmamtraced' = pvmtoplvl
pvmrbuf' = &$unknown_1993367
pvmschedtid' = &$unknown_1993352
pvmtoplvl' = 0
r' = 0
sbf' = -2
tidlist' = 0
tids' = $param_6
w' = 0
where' = $param_4




Change Warning 2806.2866 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: