Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Uninitialized Variable  at trcutil.c:3037

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 22160.29169
Procedure: trc_copy_str
Trace: view
Modified: Thu Nov 26 11:35:34 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/tracer/trcfile.c
   Enter trc_store_trace_event
true964 trc_store_trace_event( ID, TD, tid, omit ) 
 965 TRC_ID ID;
 966 TRC_TEVDESC TD;
 967 int tid;
 968 int omit;
 969 {
 970         TRC_DATADESC DD;
 971  
 972         TRC_TEVTASK TT;
 973  
 974         char    upk_byte[TRC_MAX_UNPACK_ARR_SIZE];
   ...
 989         int maxlen;
 990         int ignore;
 991         int tusec;
 992         int tsec;
 993         int len;
 994         int num;
 995         int i;
 996  
 997         /* Dump Descriptor (if necessary) */ 
 998  
 999         if ( !omit && TD->dump )
 1000                 trc_dump_tevdesc( ID, TD, tid );
 1001  
 1002         /* Set New Task Flag */ 
 1003  
 1004         TT = (TRC_TEVTASK) NULL;
 1005  
 1006         tsec = tusec = -1;
 1007  
 1008         newtask = TRC_FALSE;
 1009         endtask = TRC_FALSE;
 1010  
 1011         if ( !strcmp( TD->name, "newtask" ) 
 1012                 || !strcmp( TD->name, "spntask" ) )
 1013         {
 1014                 newtask = TRC_TRUE;
 1015         }
 1016  
 1017         else if ( !strcmp( TD->name, "endtask" ) )
 1018                 endtask = TRC_TRUE;
 1019  
 1020         ignore = TRC_FALSE;
 1021  
 1022         /* Store Event Header */ 
 1023  
 1024         if ( !omit )
 1025                 trc_store_event_header( ID, TD, tid );
 1026  
 1027         /* Store Remainder of Event */ 
 1028  
 1029         DD = TD->ddesc;
 1030  
 1031         while ( DD != NULL )
 1032         {
 1033                 if ( DD->array == TEV_DATA_ARRAY )
 1034                 {
 1035                         TRC_PVMCKERR( pvm_upkint( &num, 1, 1 ),
 1036                                 "Array Unpack", return( TRC_FALSE ) );
 1037  
 1038                         if ( num > TRC_MAX_UNPACK_ARR_SIZE   /* Uninitialized Variable (ID: 22163.29172) */
 1039                                 && DD->dt != TEV_DATA_STRING )
 1040                         {
 1041                                 if ( !omit )
 1042                                         printf( "Error: Unpack Size %d Too Large\n", num );
 1043  
   ...
 1063                                 }
 1064  
 1065                                 else 
 1066                                 {
 1067                                         fprintf( ID->trace_out, "[%d] { ", num );
 1068                                         /* matching } */ 
 1069                                 }
 1070                         }
 1071                 }
 1072  
 1073                 else 
 1074                         num = 1;
 1075  
 1076                 switch ( DD->dt ) 
 1077                 {
 1078                         case TEV_DATA_NULL: break;
 1079  
 1080                         case TEV_DATA_BYTE: 
 1081                         {
 1082                                 TRC_PVMCKERR( pvm_upkbyte( upk_byte, num, 1 ),
 1083                                         "Event BYTE Unpack", return( TRC_FALSE ) );
 1084  
 1085                                 if ( omit )
 1086                                         break;
   ...
 1355                                 {
 1356                                         fprintf( ID->trace_out, "%u", upk_short[i] );
 1357  
 1358                                         if ( i < num - 1 )
 1359                                                 fprintf( ID->trace_out, ", " );
 1360                                 }
 1361  
 1362                                 break;
 1363                         }
 1364  
 1365                         case TEV_DATA_STRING: 
 1366                         {
 1367                                 if ( num < 1 )
 1368                                         break;
 1369  
 1370                                 strarr = (char **) malloc( (unsigned) num 
 1371                                                 * sizeof(char *) );   /* Integer Overflow of Allocation Size (ID: 22158.29167) */  /* Leak (ID: 22156.29165) */
 1372                                 trc_memcheck( strarr, "String Array" );
 1373  
 1374                                 maxlen = 0;
 1375  
 1376                                 for ( i=0 ; i < num ; i++ )
 1377                                 {
 1378                                         TRC_PVMCKERR( pvm_upkstr( upk_str ),
 1379                                                 "Event STRING Unpack", return( TRC_FALSE ) );
 1380  
 1381                                         if ( (len = strlen( upk_str )) > maxlen )   /* Uninitialized Variable (ID: 22162.29171) */
 1382                                                 maxlen = len;
 1383  
upk_str is uninitialized1384                                         strarr[i] = trc_copy_str( upk_str );
     /kat0/fletcher/SATE/2010/pvm3/tracer/trcutil.c
     Enter trc_store_trace_event / trc_copy_str
 3031   char * 
 3032   trc_copy_str( str ) 
 3033   char *str;
 3034   {
 3035           char *tmp;
 3036    
*str is uninitialized3037           tmp = (char *) malloc( (unsigned) (strlen(str) + 1)     /* Uninitialized Variable */  /* 2 more... */
     Exit trc_store_trace_event / trc_copy_str
Preconditions
$param_4 != 0
&$unknown_11707757 >= 1
((char*)&((char*)*$param_2)[24])[4] = 12
((char*)&((char*)*$param_2)[24])[8] != 128
**$param_2 = 110
strlen(*$param_2) = 7
pvmrbuf != 0
pvmtoplvl = 0
strlen(&upk_str[0]) = &$unknown_11707757
strlen(&upk_str[0]) >= 1
Postconditions
DD' = TD->ddesc
TRC_TMP_CC' = 0
TT' = 0
endtask' = 0
bytes_after(&$heap_409359)' = 4
$heap_409359' is allocated by malloc
$heap_409359' is allocated
bytes_before(&$heap_409359)' = 0
i' = 0
ignore' = 0
len' = &$unknown_11707757
maxlen' = &$unknown_11707757
newtask' = 1
num' = 1
str' = &upk_str[0]
strarr' = &$heap_409359
tsec' = -1
tusec' = -1




Change Warning 22160.29169 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: