Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Buffer Overrun  at lpvm.c:2722

Categories: LANG.MEM.BO CWE:120 CWE:121 CWE:122 CWE:126
Warning ID: 22186.29351
Procedure: pvmmcast
Trace: view
Modified: Thu Nov 26 11:38:46 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/pvmgs/pvmgs_func.c
   Enter gs_barrier
 786 gs_barrier(gname, msgtag, cnt, tid, hash_list, ngroups) 
 787 char *gname;
 788 int msgtag;
 789 int cnt;
 790 int tid;
 791 GROUP_LIST_PTR hash_list;
 792 int *ngroups;
 793 {
 794         int i, info;
 795         int gstate;
 796         int pcoord;
 797         int nhosts, nmem_onhost;  
 798          
 799         GROUP_STRUCT_PTR group;
 800  
 801         /* check for valid group name */ 
 802         if (gname == (char*) 0 || *gname == '\0')   /* Uninitialized Variable (ID: 22197.29366) */
 803                 return(PvmNullGroup);
 804  
 805         group = gs_group(gname, hash_list, ngroups, NOCREATE);
 806         if (group == (GROUP_STRUCT_PTR) NULL)
 807                 return(PvmNoGroup);
 808          
 809         if (group->staticgroup == STATICDEAD)
 810                 return(PvmNoGroup);
 811  
 812         for (i = 0; i < group->maxntids; i++) /* tid is in group?          */ 
 813                 if (group->tids[i] == tid) break;
 814                         if (i == group->maxntids)  
 815                                 return(PvmNotInGroup);
 816          
 817         /* if it's the whole group the set the count to the # in the group */ 
 818         if (cnt == -1)  
 819                 cnt = group->ntids;
 820          
 821         if (group->barrier_count == -1)  /* is it a new barrier ?       */ 
 822         {
 823                 group->barrier_count = cnt;
 824                 group->barrier_reached = 0;
true825                 group->barrier_index = 0;
 826         }
 827         else 
 828         {
 829                 if (cnt != group->barrier_count)  /* make sure counts match    */ 
 830                         return(PvmMismatch);
 831         }
 832          
 833         /* store the tid */ 
&$unknown_13713118 >= 4834         group->btids = gs_realloc_int_array(group->barrier_index + 1,  
&$unknown_13713106 >= 4835                         &(group->maxbtids), group->btids, DELTABTIDS, NOTID,
&$unknown_13713103 >= 4836                         "gs_barrier");  
 837  
&$unknown_13713130 > bytes_after(group->btids)838         group->btids[group->barrier_index++] = tid;   /* Null Pointer Dereference (ID: 557.29352) */
 839  
&$unknown_13713139 > bytes_after(group->btids)840         if (msgtag == BARRIER)
 841                 group->barrier_reached++;
&$unknown_13713142 > bytes_after(group->btids)842         else  /* (msgtag == BARRIERV) */ 
 843         /* an on-host coordinator is representing nmem_onhost tasks in 
 844         this barrier call */ 
 845         {
&$unknown_13713157 > bytes_after(group->btids)846                 gs_host_char(gname, hash_list, ngroups, gs_tidtohost(tid),  
&$unknown_13713145 > bytes_after(group->btids)847                                 &pcoord, &nmem_onhost, &nhosts, &gstate);
 848  
&$unknown_13713202 > bytes_after(group->btids)849                 group->barrier_reached += nmem_onhost;  
 850         }
 851          
 852         /* if reached is bigger than count then there is a problem         */ 
 853         /* this would happen if count was zero                             */ 
 854  
&$unknown_13713205 > bytes_after(group->btids)855         if (group->barrier_count < group->barrier_reached)
 856                 return(PvmMismatch);
 857          
 858         /* if we're not at the barrier then return                         */ 
&$unknown_13713208 > bytes_after(group->btids)859         if (group->barrier_count != group->barrier_reached)
 860                 return(PvmOk);
 861          
 862         /* let everyone continue, send them the count                      */ 
&$unknown_13713211 > bytes_after(group->btids)863         pvm_initsend(PvmDataDefault);
&$unknown_13713217 > bytes_after(group->btids)864         pvm_pkint(&(group->barrier_count), 1, 1);
&$unknown_13713227 > bytes_after(group->btids)865         pvm_mcast(group->btids, group->barrier_index, BARRIER);            
     /kat0/fletcher/SATE/2010/pvm3/src/lpvmgen.c
     Enter gs_barrier / pvm_mcast
&$unknown_13713230 > bytes_after(tids)2298   pvm_mcast(tids, count, tag) 
 2299           int *tids;              /* dest tasks */ 
 2300           int count;              /* number of tids */ 
 2301           int tag;                /* message type tag */ 
 2302   {
 2303           int cc;                 /* for return codes */ 
 2304           int i;
&$unknown_13713231 > bytes_after(tids)2305           TEV_DECLS 
 2306    
&$unknown_13713232 > bytes_after(tids)2307           if (TEV_EXCLUSIVE) {
&$unknown_13713236 > bytes_after(tids)2308                   if (TEV_DO_TRACE(TEV_MCAST,TEV_EVENT_ENTRY)) {
 2309                           int nb = -1;
 2310                           pvm_bufinfo( 
 2311                                           ( pvmtrcsbfsave ) ? pvmtrcsbfsave : pvmsbuf->m_mid,
 2312                                           &nb, (int *) NULL, (int *) NULL );
 2313                           TEV_PACK_INT( TEV_DID_MNB, TEV_DATA_SCALAR, &nb, 1, 1 );
 2314                           TEV_PACK_INT( TEV_DID_MC, TEV_DATA_SCALAR, &tag, 1, 1 );
 2315                           TEV_PACK_INT( TEV_DID_MCX, TEV_DATA_SCALAR,
 2316                                           &pvmmyctx, 1, 1 );
 2317                           TEV_PACK_INT( TEV_DID_MDL, TEV_DATA_ARRAY, tids, count, 1 );
 2318                           TEV_FIN;
 2319                   }
 2320           }
 2321    
 2322           /* sanity check args and sendable message */ 
 2323    
&$unknown_13713241 > bytes_after(tids)2324           if (!(cc = BEATASK)) {
&$unknown_13713245 > bytes_after(tids)2325                   if (!pvmsbuf)
 2326                           cc = PvmNoBuf;
&$unknown_13713246 > bytes_after(tids)2327                   else if (count < 0 || (!pvmrescode && (tag & ~0x7fffffff)))
 2328                                   cc = PvmBadParam;
&$unknown_13713249 > bytes_after(tids)2329                   else if (!pvmrescode)
 2330                           for (i = count; i-- > 0; )
 2331                                   if (!TIDISTASK(tids[i])) {
 2332                                           cc = PvmBadParam;
 2333                                           break;
 2334                                   }
 2335    
 2336           }
 2337    
&$unknown_13713251 > bytes_after(tids)2338           if (!cc && count > 0)
&$unknown_13713253 > bytes_after(tids)2339                   cc = pvmmcast(pvmsbuf->m_mid, tids, count, tag);
       /kat0/fletcher/SATE/2010/pvm3/src/lpvm.c
       Enter gs_barrier / pvm_mcast / pvmmcast
&$unknown_13713257 > bytes_after(tids)2704     pvmmcast(mid, tids, count, tag) 
 2705             int mid;        
 2706             int *tids;
 2707             int count;
 2708             int tag;
 2709     {
 2710             static struct timeval ztv = { 0, 0 };
 2711      
 2712             int *dst;
 2713             int i, j;
&$unknown_13713258 > bytes_after(tids)2714             int cc = 0;
 2715             struct ttpcb *pcbp;
 2716             int sbf;
 2717      
 2718             /*
 2719             * make sorted list of destinations 
 2720             */ 
&$unknown_13713259 > bytes_after(tids)2721             dst = TALLOC(count, int, "mcal");   /* Integer Overflow of Allocation Size (ID: 382.29086) */
count > bytes_after(tids)2722             BCOPY(tids, dst, count * sizeof(int));     /* Buffer Overrun */  /* Null Pointer Dereference (ID: 381.29085) */
       Exit gs_barrier / pvm_mcast / pvmmcast
     Exit gs_barrier / pvm_mcast
Preconditions
tids != 3
count = -1
$param_5 >= 2956
&$unknown_13713264 >= 1
((char*)mid)[1] = 0
((char*)&((char*)((char*)*$param_5)[1144])[8])[16] >= 2
((char*)&((char*)((char*)*$param_5)[1144])[8])[20] = -1
((char*)&((char*)((char*)*$param_5)[1144])[8])[32] = 0
((char*)&((char*)((char*)*$param_5)[1144])[8])[36] = 0
((char*)&((char*)((char*)*$param_5)[1144])[8])[4] >= 2
((char*)&((char*)((char*)*$param_5)[1144])[8])[56] != 3
((char*)&((char*)((char*)*$param_5)[1144])[8])[8] = 0
*mid >= 127
strlen(mid) = 1
strlen(((char*)((char*)*$param_5)[1144])[8]) = 1
numpmsgs = 0
nxtmidhsiz <= pvmmidhsiz
pvmmidhfree = 0
pvmmidhsiz != 0
pvmrescode != 0
pvmsbuf >= 0
pvmtoplvl != 0
Postconditions
cc' = 0
cc' = 0
cnt' = hash_list[95].next->group->ntids
codesonar_distance_tweak' = 2
count' = 1
count' = 1
dst' = &$heap_461990
group' = hash_list[95].next->group
gstate' = 2
$heap_461989' = tid
bytes_after(&$heap_461989)' = 0
$heap_461989' is allocated by malloc
bytes_before(&$heap_461989)' = 0
$heap_461990' = tid
bytes_after(&$heap_461990)' = 4
$heap_461990' is allocated by malloc
$heap_461990' is allocated
bytes_before(&$heap_461990)' = 0
nhosts' = 0
nmem_onhost' = 0
pcoord' = -1
pvmampushed' = 0
pvmamtraced' = pvmtoplvl
pvmmytid' = &$unknown_13713264
pvmsbuf' = &$unknown_13713265
pvmtoplvl' = 0
pvmtrc.trctid' = &$unknown_13713264
tag' = 3
tag' = 3
tids' = &$heap_461989
tids' = &$heap_461989




Change Warning 22186.29351 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: