Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at ddpro.c:1539

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2529.2560
Procedure: exectasks
Trace: View
Modified: Wed Sep 2 12:40:32 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/ddpro.c
   Enter exectasks
 1401 exectasks(mp, rmp, schtid) 
 1402         struct pmsg *mp;                /* the request message */ 
 1403         struct pmsg *rmp;               /* reply message blank */ 
 1404         int schtid;                             /* scheduler for new tasks */ 
 1405 {
 1406         struct pmsg *mp2;                       /* reply message hdl */ 
 1407         int i;
 1408         struct timeval now;
 1409         struct waitc_spawn *wxp;        /* new task parameters */ 
 1410         int munge_tenv = 0;
 1411         char tmp[255];
 1412         char *wd = 0;
 1413         char *savewd = 0;
 1414  
 1415         wxp = TALLOC(1, struct waitc_spawn, "waix");
 1416         BZERO((char*)wxp, sizeof(struct waitc_spawn));   /* Null Pointer Dereference (ID: 2534.2565) */
 1417  
 1418         /* unpack message */ 
 1419  
 1420         if (upkuint(mp, &wxp->w_ptid) 
 1421         || upkstralloc(mp, &wxp->w_file) 
 1422         || upkint(mp, &wxp->w_flags) 
 1423         || upkint(mp, &wxp->w_veclen) 
 1424         || upkint(mp, &wxp->w_argc))
 1425                 goto bad;
 1426  
 1427         if (wxp->w_veclen < 1)
 1428                 goto bad;
 1429         wxp->w_vec = TALLOC(wxp->w_veclen, int, "tids");
 1430  
 1431         wxp->w_argc += 2;
 1432         wxp->w_argv = TALLOC(wxp->w_argc + 1, char*, "argv");
 1433         BZERO((char*)wxp->w_argv, (wxp->w_argc + 1) * sizeof(char*));   /* Null Pointer Dereference (ID: 2533.2564) */
 1434         wxp->w_argv++;
 1435         wxp->w_argv[0] = wxp->w_file;   /* Null Pointer Dereference (ID: 2532.2563) */
 1436         wxp->w_file = 0;
 1437         wxp->w_argv[--wxp->w_argc] = 0;
 1438         for (i = 1; i < wxp->w_argc; i++)
 1439                 if (upkstralloc(mp, &wxp->w_argv[i]))
 1440                         goto bad;
 1441  
 1442         if (upkuint(mp, &wxp->w_outtid) 
 1443         || upkuint(mp, &wxp->w_outctx) 
 1444         || upkuint(mp, &wxp->w_outtag) 
 1445         || upkuint(mp, &wxp->w_trctid) 
 1446         || upkuint(mp, &wxp->w_trcctx) 
 1447         || upkuint(mp, &wxp->w_trctag) 
 1448         || upkuint(mp, &wxp->w_nenv))
 1449                 goto bad;
 1450  
 1451         wxp->w_hosttotal = wxp->w_veclen; /* this is the task count! */ 
 1452  
 1453         if (pvmtracer.trctid) {
 1454                 if (!(wxp->w_trctid) && pvmtracer.trctag) {
 1455                         wxp->w_trctid = pvmtracer.trctid;
 1456                         wxp->w_trcctx = pvmtracer.trcctx;
 1457                         wxp->w_trctag = pvmtracer.trctag;
 1458                         munge_tenv++;
 1459                 }
 1460         }
 1461  
 1462         if (pvmtracer.outtid) {
 1463                 if (!(wxp->w_outtid) && pvmtracer.outtag) {
 1464                         wxp->w_outtid = pvmtracer.outtid;
 1465                         wxp->w_outctx = pvmtracer.outctx;
 1466                         wxp->w_outtag = pvmtracer.outtag;
 1467                 }
 1468         }
 1469  
 1470         wxp->w_env = TALLOC((wxp->w_nenv + 1), char*, "env");
 1471         BZERO(wxp->w_env, (wxp->w_nenv + 1) * sizeof(char*));   /* Null Pointer Dereference (ID: 2531.2562) */
 1472  
 1473         for (i = 0; i < wxp->w_nenv; i++)
 1474                 if (upkstralloc(mp, &wxp->w_env[i]))
 1475                         goto bad;
 1476  
 1477         if ( upkuint(mp, &wxp->w_instance) || upkuint(mp, &wxp->w_outof))
 1478                 goto bad;
 1479  
 1480         /* check for spawn working directory */ 
 1481  
 1482         for (i = 0; i < wxp->w_nenv; i++)
 1483                 if ( !strncmp( "PVMSPAWNWD=", wxp->w_env[i],
 1484                                 strlen("PVMSPAWNWD=") ) )
 1485                         wd = STRALLOC( wxp->w_env[i] + strlen("PVMSPAWNWD=") );   /* Null Pointer Dereference (ID: 2530.2561) */
 1486  
 1487         /* munge env for tracing stuff */ 
 1488  
 1489         if ( munge_tenv ) {
 1490                 sprintftmp, "PVMTMASK=%s", pvmtracer.tmask );
 1491                 pvmenvinsert( &(wxp->w_env), tmp );
 1492  
 1493                 sprintftmp, "PVMTRCBUF=%d", pvmtracer.trcbuf );
 1494                 pvmenvinsert( &(wxp->w_env), tmp );
 1495  
 1496                 sprintftmp, "PVMTRCOPT=%d", pvmtracer.trcopt );
 1497                 pvmenvinsert( &(wxp->w_env), tmp );
 1498  
 1499                 for ( wxp->w_nenv = 0 ; wxp->w_env[ wxp->w_nenv ] ;
 1500                         (wxp->w_nenv)++ );
 1501         }
 1502  
 1503         /* call ppi_load to get tasks running */ 
 1504  
 1505         wxp->w_sched = schtid;
 1506  
 1507         /* change to desired working directory (if specified) */ 
 1508         if (wd) {
 1509                 savewd = (char *) getcwd( (char *) NULL, 255 );
 1510                 chdir( wd );   /* Ignored Return Value (ID: 2974.3060) */
 1511         }
 1512  
 1513 #if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \
 1514                 || defined(IMA_AIX5SP2) || defined(IMA_BEOLIN) 
 1515         if (!(wxp->w_flags & PvmMppFront))
 1516         {
 1517                 mpp_load(wxp);
 1518         }
 1519         else 
 1520 #endif 
 1521         {
 1522                 ppi_load(wxp);
 1523         }
 1524  
 1525         /* go back to original directory (if getcwd() was successful) */ 
 1526         if (savewd)
 1527                 chdir( savewd );   /* Ignored Return Value (ID: 2974.3059) */
 1528  
 1529 for (i = 0; i < wxp->w_veclen; i++) {
 1530                 if (wxp->w_vec[i] > 0) {
 1531                         if (wxp->w_trctid > 0) {
 1532                                 tev_send_newtask( 
 1533                                         wxp->w_trctid, wxp->w_trcctx, wxp->w_trctag,
 1534                                         wxp->w_vec[i], wxp->w_ptid, wxp->w_flags,
 1535                                         wxp->w_argv[0] );
 1536                         }
 1537                         if (wxp->w_outtid > 0) {
true1538                                 mp2 = mesg_new(0);
mp2 <= 40951539                                 mp2->m_dst = wxp->w_outtid;     /* Null Pointer Dereference */
Preconditions
&$unknown_401956 >= 1
strlen(&$unknown_401952) > 11
((char*)&$heap_24583)[40] >= 1
((char*)&$heap_24583)[48] >= 1
((char*)&$heap_24583)[60] >= 1
pvmtracer.trctid = 0
pvmtracer.outtid != 0
$input_12 >= 3
$input_6340 != 0
Postconditions
codesonar_distance_tweak' = 3
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
$heap_24583' = 0
bytes_after(&$heap_24583)' = 112
$heap_24583' is allocated by malloc
bytes_before(&$heap_24583)' = 0
strlen(&$heap_24583)' = 0
((char*)&$heap_24583)[16]' = &$heap_24585 + 8
((char*)&$heap_24583)[32]' = &$heap_24584
((char*)&$heap_24583)[80]' = &$heap_24587
((char*)&$heap_24583)[92]' = $param_3
((char*)&$heap_24583)[100]' = ((char*)&$heap_24583)[40]
$heap_24584' = &$unknown_401956
bytes_after(&$heap_24584)' = 4 * ((char*)&$heap_24583)[40]
$heap_24584' is allocated by malloc
$heap_24584' is allocated
bytes_before(&$heap_24584)' = 0
$heap_24585' = 0
$heap_24585' is allocated by malloc
bytes_before(&$heap_24585)' = 0
strlen(&$heap_24585)' = 0
((char*)&$heap_24585)[8]' = 0
$heap_24587' = 0
$heap_24587' is allocated by malloc
bytes_before(&$heap_24587)' = 0
strlen(&$heap_24587)' = 0
bytes_after(&$heap_24589)' = strlen(&$unknown_401953) + 1
$heap_24589' is allocated by malloc
$heap_24589' is allocated
bytes_before(&$heap_24589)' = 0
strlen(&$heap_24589)' = strlen(&$unknown_401954)
$heap_24590' = $input_6340
bytes_after(&$heap_24590)' = $input_12
$heap_24590' is allocated by malloc
$heap_24590' is allocated
bytes_before(&$heap_24590)' = 0
strlen(&$heap_24590)' = $input_12 - 1
i' = 0
mp' = $param_1
mp2' = 0
munge_tenv' = 0
numpmsgs' = 0
rmp' = $param_2
save' = &$heap_24590
savewd' = &$heap_24590
schtid' = $param_3
wd' = &$heap_24589
wxp' = &$heap_24583




Change Warning 2529.2560 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: