Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Integer Overflow of Allocation Size  at lpvmgen.c:3322

Categories: ALLOC.IOAS BSI:MALLOC-OVERFLOW CWE:680
Warning ID: 22126.29096
Procedure: pvm_tasks
Trace: view
Modified: Thu Nov 26 11:31:59 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/lpvmgen.c
   Enter pvm_tasks
 3271 pvm_tasks(where, ntaskp, taskp) 
 3272         int where;                                      /* which host or 0 for all */ 
 3273         int *ntaskp;
 3274         struct pvmtaskinfo **taskp;
 3275 {
 3276         int cc, ec, sbf, rbf, ae;
 3277         static struct pvmtaskinfo *tlist = 0;
 3278         static int ntask = 0;
 3279         int len1 = 5, len2 = 3;
 3280         TEV_DECLS 
 3281  
 3282         if (TEV_EXCLUSIVE) {
 3283                 if (TEV_DO_TRACE(TEV_TASKS,TEV_EVENT_ENTRY)) {
 3284                         TEV_PACK_INT( TEV_DID_TW, TEV_DATA_SCALAR, &where, 1, 1 );
 3285                         TEV_FIN;
 3286                 }
 3287         }
 3288  
 3289         if (tlist) {
 3290                 while (ntask-- > 0)
 3291                         PVM_FREE(tlist[ntask].ti_a_out);
 3292                 PVM_FREE(tlist);
 3293                 tlist = 0;
 3294                 ntask = 0;
 3295         }
 3296  
 3297         if (!(cc = BEATASK)) {
 3298                 sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
 3299                 rbf = pvm_setrbuf(0);
 3300                 pvm_pkint(&where, 1, 1);
 3301  
 3302                 if (pvmschedtid)
 3303                         cc = msendrecv(pvmschedtid, SM_TASK, PvmBaseContext);
 3304                 else 
 3305                         cc = msendrecv(TIDPVMD, TM_TASK, SYSCTX_TM);
 3306                 if (cc > 0) {
 3307                         if (!(cc = pvm_upkint(&ec, 1, 1)) 
 3308                         && (cc = ec) >= 0) {
 3309                                 tlist = TALLOC(len1, struct pvmtaskinfo, "ti");
 3310                                 ae = pvm_setopt(PvmAutoErr, 0);
 3311                                 ntask = 0;
 3312                                 while (!pvm_upkint(&tlist[ntask].ti_tid, 1, 1)) {
 3313                                         pvm_upkint(&tlist[ntask].ti_ptid, 1, 1);
 3314                                         pvm_upkint(&tlist[ntask].ti_host, 1, 1);
 3315                                         pvm_upkint(&tlist[ntask].ti_flag, 1, 1);
 3316                                         pvmupkstralloc(&(tlist[ntask].ti_a_out));
 3317                                         pvm_upkint(&tlist[ntask].ti_pid, 1, 1);
 3318                                         ntask++;
 3319                                         if (ntask == len1) {
 3320                                                 len1 += len2;
 3321                                                 len2 = ntask;
true3322                                                 tlist = TREALLOC(tlist, len1, struct pvmtaskinfo);     /* Integer Overflow of Allocation Size */
Preconditions
&$unknown_5130746 >= 1
&$unknown_5130747 != 0
ntask >= 1
pvmautoerr != 0
pvmautoerr != 2
pvmautoerr != 3
pvmmytid = -1
pvmtoplvl != 0
pvmtrc.trctid >= 1
pvmtrc.trcopt != 1
pvmtrc.trcopt != 2
pvmtrc.trcopt != 3
Postconditions
*tlist' is freed
cc' >= 0
ec' = cc'
bytes_before(&$heap_371113)' = 0
pvmampushed' = 0
pvmamtraced' = pvmtoplvl
pvmmytid' != -1
pvmrbuf' = &$unknown_5130747
pvmschedtid' = 0
pvmtoplvl' = 0
pvmtrccodef' = &$unknown_5130717
rbf' = -16
sbf' = -2
tlist' = 0




Change Warning 22126.29096 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: