Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at imalloc.c:547

Categories: LANG.MEM.NPD CWE:476
Warning ID: 201.28833
Procedure: i_dump
Trace: view
Modified: Thu Nov 26 11:28:11 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
   /kat0/fletcher/SATE/2010/pvm3/src/imalloc.c
   Enter i_dump
 495 i_dump(how) 
 496         int how;                        /* != 0 also do sanity checking */ 
 497 {
 498         int ht;                         /* hash table index */ 
 499         struct glob *ob;
 500         char *r;
 501         int i;
 502         int rs;                         /* reproduced random seqn */ 
 503         char *ptr;                      /* gp */ 
 504         int err;
 505         char tagstr[5];
 506  
 507 #if     STATICGLOBS > 0 
 508         sprintf(msbuf, "%s %d bytes total/%d globs free\n",
 509                         DUMPHDR, totlnbyts, globavail);
 510         (void)SWRITE(debfd, msbuf); 
 511 #else 
 512         sprintf(msbuf, "%s %d bytes total\n", DUMPHDR, totlnbyts);
 513         (void)SWRITE(debfd, msbuf);
 514 #endif 
 515         for (ht = 0; ht < 256; ht++) {
 516                 for (ob = hashtbl[ht]; ob; ob = ob->next) {
 517                         rs = ob->rst;
 518                         ptr = ob->base;
 519                         err = 0;
 520                         if (how) {
 521                                 for (i = ob->lop, ptr -= i; i > 0; i--)
 522                                         if ((0xff & (int)(*ptr++)) != (0xff & NEXTRN(rs))) {
 523                                                 (void)sprintf(msbuf,
 524                                                         "%5d 0x%08lx[%d]: scribbled in [%d]\n",
 525                                                         ob->id, (long) ob->base, ob->len, -i);
 526                                                 (void)SWRITE(debfd, msbuf);
 527                                                 err++;
 528                                         }
 529                                 for (i = ob->hip, ptr += ob->len; i > 0; i--)
 530                                         if ((0xff & (int)(*ptr++)) != (0xff & NEXTRN(rs))) {
 531                                                 (void)sprintf(msbuf,
 532                                                         "%5d 0x%08lx[%d]: scribbled in [%d+%d]\n",
 533                                                         ob->id, (long) ob->base, ob->len, ob->len,
 534                                                         ob->hip - i);
 535                                                 (void)SWRITE(debfd, msbuf);
 536                                                 err++;
 537                                         }
 538                         }
 539                         if (!err) {
 540                                 strncpy(tagstr, ob->tag, 4);
true541                                 tagstr[4] = 0;
 542                                 sprintf(msbuf, "%5d%c%4s 0x%08lx[%4d]",
 543                                         ob->id,
 544                                         (ob->flg & OBALLOC ? '*' : 
true545                                                 (ob->flg & OBREALLOC ? '+' : ' ')),
$temp59 <= 4095546                                         tagstr,
 547                                         (long) ob->base, ob->len);     /* Null Pointer Dereference */
 548                                 r = msbuf + strlen(msbuf);
 549                                 *r++ = ' ';
 550                                 if ((i = ob->len) > 24)
 551                                         i = 24;
 552                                 ascdump(&r, ob->base, i);
 553                                 (void)SWRITE(debfd, msbuf);
 554                         }
 555                         ob->flg &= ~(OBALLOC|OBREALLOC);
Preconditions
how != 0
hashtbl[255]->lop >= 2
hashtbl[255]->hip >= 2
strlen(hashtbl[255]) <= 35
strlen(hashtbl[255]) >= 32
Postconditions
atnewline' = 1
err' = 0
errno' != 0
ht' = 255
i' = 0
strlen(&msbuf[0])' = 76
msbuf[33]' = 0
msbuf[64]' = 0
msbuf[76]' = 0
ob' = hashtbl[255]
ptr' = &$unknown_695879 + 2
tagstr[0]' = hashtbl[255]->tag[0]
strlen(&tagstr[0])' = 4
tagstr[4]' = 0
tmbuf.tm_sec' = &$unknown_695881




Change Warning 201.28833 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: