freeglut-3.6.0-1.fc41
List of Defects
Error: COMPILER_WARNING (CWE-252): [#def1]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/CallbackMaker/CallbackMaker.c: scope_hint: In function ‘Error’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/CallbackMaker/CallbackMaker.c:239:5: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
# 239 | fgets ( dummy_string, STRING_LENGTH, stdin );
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 237| /* terminate program, after pause for input so user can see */
# 238| printf ( "Please enter something to exit: " );
# 239|-> fgets ( dummy_string, STRING_LENGTH, stdin );
# 240|
# 241| /* Call exit directly as freeglut is messed
Error: COMPILER_WARNING (CWE-252): [#def2]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/CallbackMaker/CallbackMaker.c: scope_hint: In function ‘main’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/CallbackMaker/CallbackMaker.c:733:3: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
# 733 | fgets ( dummy_string, STRING_LENGTH, stdin );
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 731|
# 732| printf ( "Please enter something to continue: " );
# 733|-> fgets ( dummy_string, STRING_LENGTH, stdin );
# 734|
# 735| glutMainLoop();
Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals/fractals.c: scope_hint: In function ‘readConfigFile’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals/fractals.c:260:20: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fnme, "rt")’
# 258| checkedFGets ( inputline, sizeof ( inputline ), fptr ) ;
# 259|
# 260|-> for ( i = 0; i < num_trans; i++ )
# 261| {
# 262| /* Read an affine transformation definition */
Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals/fractals.c:260:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fnme, "rt")’
# 258| checkedFGets ( inputline, sizeof ( inputline ), fptr ) ;
# 259|
# 260|-> for ( i = 0; i < num_trans; i++ )
# 261| {
# 262| /* Read an affine transformation definition */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals/fractals.c:274:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘affine’
# 272| num_trans = 4 ;
# 273| affine = (AffineTrans *)malloc ( num_trans * sizeof(AffineTrans) ) ;
# 274|-> affine[0].a00 = 1/3. ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 1/3. ;
# 275| affine[0].b0 = 0.0 ; affine[0].b1 = 0.0 ;
# 276|
Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals_random/fractals_random.c: scope_hint: In function ‘readConfigFile’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals_random/fractals_random.c:304:20: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fnme, "rt")’
# 302| checkedFGets ( inputline, sizeof ( inputline ), fptr ) ;
# 303|
# 304|-> for ( i = 0; i < num_trans; i++ )
# 305| {
# 306| /* Read an affine transformation definition */
Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals_random/fractals_random.c:304:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fnme, "rt")’
# 302| checkedFGets ( inputline, sizeof ( inputline ), fptr ) ;
# 303|
# 304|-> for ( i = 0; i < num_trans; i++ )
# 305| {
# 306| /* Read an affine transformation definition */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Fractals_random/fractals_random.c:318:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘affine’
# 316| num_trans = 4 ;
# 317| affine = (AffineTrans *)malloc ( num_trans * sizeof(AffineTrans) ) ;
# 318|-> affine[0].a00 = 1/3. ; affine[0].a01 = 0.00 ; affine[0].a10 = 0.00 ; affine[0].a11 = 1/3. ;
# 319| affine[0].b0 = 0.0 ; affine[0].b1 = 0.0 ;
# 320|
Error: GCC_ANALYZER_WARNING: [#def9]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Lorenz/lorenz.c: scope_hint: In function ‘advance_in_time’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Lorenz/lorenz.c:87:3: warning[-Wanalyzer-overlapping-buffers]: overlapping buffers passed as arguments to ‘memcpy’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/Lorenz/lorenz.c:33: included_from: Included from here.
/usr/include/string.h:43:14: note: the behavior of ‘memcpy’ is undefined for overlapping buffers
# 85| double deriv0[3], deriv1[3], deriv2[3], deriv3[3] ;
# 86| int i ;
# 87|-> memcpy ( new_position, position, 3 * sizeof(double) ) ; /* Save the present values */
# 88|
# 89| /* First pass in a Fourth-Order Runge-Kutta integration method */
Error: CPPCHECK_WARNING: [#def10]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/joystick/joystick.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def11]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-121): [#def12]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c: scope_hint: In function ‘display’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:48:25: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:4: included_from: Included from here.
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:48:25: note: write of 4 bytes to beyond the end of ‘str’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:48:25: note: valid subscripts for ‘str’ are ‘[0]’ to ‘[255]’
# 46| if(cur_key > 0) {
# 47| if(isprint(cur_key)) {
# 48|-> sprintf(str + 4, " '%c'", cur_key);
# 49| } else {
# 50| sprintf(str + 4, " 0x%02x", cur_key);
Error: GCC_ANALYZER_WARNING (CWE-121): [#def13]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:50:25: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:50:25: note: write of 4 bytes to beyond the end of ‘str’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/keyboard/keyboard.c:50:25: note: valid subscripts for ‘str’ are ‘[0]’ to ‘[255]’
# 48| sprintf(str + 4, " '%c'", cur_key);
# 49| } else {
# 50|-> sprintf(str + 4, " 0x%02x", cur_key);
# 51| }
# 52|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/subwin/subwin.c: scope_hint: In function ‘main’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/subwin/subwin.c:223:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘strings’
# 221| strings = malloc(sizeof(char *)*(winmax+1));
# 222| for (i=0;i<winmax+1;i++) {
# 223|-> strings[i] = malloc(sizeof(char)*MAXSTR+1);
# 224| strings[i][0]=0;
# 225| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/subwin/subwin.c:224:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(17)’
# 222| for (i=0;i<winmax+1;i++) {
# 223| strings[i] = malloc(sizeof(char)*MAXSTR+1);
# 224|-> strings[i][0]=0;
# 225| }
# 226|
Error: GCC_ANALYZER_WARNING (CWE-121): [#def16]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c: scope_hint: In function ‘createMenuEntries’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:47:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:47:9: note: write of 1 byte to beyond the end of ‘temp’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:47:9: note: valid subscripts for ‘temp’ are ‘[0]’ to ‘[9]’
# 45| temp[0] = '-';
# 46|
# 47|-> sprintf(temp + 1, " %4d ms", timerInts[i]);
# 48|
# 49| glutAddMenuEntry(temp, timerInts[i]);
Error: GCC_ANALYZER_WARNING (CWE-121): [#def17]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c: scope_hint: In function ‘updateMenuEntries’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:65:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:65:9: note: write of 1 byte to beyond the end of ‘temp’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer/timer.c:65:9: note: valid subscripts for ‘temp’ are ‘[0]’ to ‘[9]’
# 63| temp[0] = '-';
# 64|
# 65|-> sprintf(temp + 1, " %4d ms", timerInts[i]);
# 66|
# 67| glutChangeToMenuEntry(i+1, temp, timerInts[i]);
Error: GCC_ANALYZER_WARNING (CWE-121): [#def18]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c: scope_hint: In function ‘createMenuEntries’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:63:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:63:9: note: write of 1 byte to beyond the end of ‘temp’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:63:9: note: valid subscripts for ‘temp’ are ‘[0]’ to ‘[9]’
# 61| temp[0] = '-';
# 62|
# 63|-> sprintf(temp + 1, " %4d ms", timerInts[i]);
# 64|
# 65| glutAddMenuEntry(temp, timerInts[i]);
Error: GCC_ANALYZER_WARNING (CWE-121): [#def19]
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c: scope_hint: In function ‘updateMenuEntries’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:81:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:81:9: note: write of 1 byte to beyond the end of ‘temp’
freeglut-3.6.0-build/freeglut-3.6.0/progs/demos/timer_callback/timer.c:81:9: note: valid subscripts for ‘temp’ are ‘[0]’ to ‘[9]’
# 79| temp[0] = '-';
# 80|
# 81|-> sprintf(temp + 1, " %4d ms", timerInts[i]);
# 82|
# 83| glutChangeToMenuEntry(i+1, temp, timerInts[i]);
Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_callbacks.c: scope_hint: In function ‘glutTimerFuncUcall’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_callbacks.c:65:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘timer’
# 63| }
# 64|
# 65|-> timer->Callback = callback;
# 66| timer->CallbackData = userData;
# 67| timer->ID = timerID;
Error: CLANG_WARNING: [#def21]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_callbacks.c:65:25: warning[core.NullDereference]: Access to field 'Callback' results in a dereference of a null pointer (loaded from variable 'timer')
# 63| }
# 64|
# 65|-> timer->Callback = callback;
# 66| timer->CallbackData = userData;
# 67| timer->ID = timerID;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c: scope_hint: In function ‘fghGenerateNormalVisualization’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:651:45: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘verticesForNormalVisualization’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2332:1: note: in expansion of macro ‘DECLARE_SHAPE_INTERFACE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2332:1: note: in expansion of macro ‘DECLARE_SHAPE_INTERFACE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1671:79: note: in expansion of macro ‘_DECLARE_INTERNAL_DRAW_DO_DECLARE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1721:1: note: in expansion of macro ‘DECLARE_INTERNAL_DRAW’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1671:79: note: in expansion of macro ‘_DECLARE_INTERNAL_DRAW_DO_DECLARE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1721:1: note: in expansion of macro ‘DECLARE_INTERNAL_DRAW’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1671:79: note: in expansion of macro ‘_DECLARE_INTERNAL_DRAW_DO_DECLARE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1721:1: note: in expansion of macro ‘DECLARE_INTERNAL_DRAW’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1671:79: note: in expansion of macro ‘_DECLARE_INTERNAL_DRAW_DO_DECLARE’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1721:1: note: in expansion of macro ‘DECLARE_INTERNAL_DRAW’
# 649| for (i=0,j=0; i<numNormalVertices*3/2; i+=3, j+=6)
# 650| {
# 651|-> verticesForNormalVisualization[j+0] = vertices[i+0];
# 652| verticesForNormalVisualization[j+1] = vertices[i+1];
# 653| verticesForNormalVisualization[j+2] = vertices[i+2];
Error: GCC_ANALYZER_WARNING (CWE-416): [#def23]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:651:55: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘vertices’
# 649| for (i=0,j=0; i<numNormalVertices*3/2; i+=3, j+=6)
# 650| {
# 651|-> verticesForNormalVisualization[j+0] = vertices[i+0];
# 652| verticesForNormalVisualization[j+1] = vertices[i+1];
# 653| verticesForNormalVisualization[j+2] = vertices[i+2];
Error: GCC_ANALYZER_WARNING (CWE-457): [#def24]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:651:55: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
# 649| for (i=0,j=0; i<numNormalVertices*3/2; i+=3, j+=6)
# 650| {
# 651|-> verticesForNormalVisualization[j+0] = vertices[i+0];
# 652| verticesForNormalVisualization[j+1] = vertices[i+1];
# 653| verticesForNormalVisualization[j+2] = vertices[i+2];
Error: COMPILER_WARNING (CWE-457): [#def25]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c: scope_hint: In function ‘fghGenerateGeometryWithIndexArray’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:762:13: warning[-Wmaybe-uninitialized]: ‘numEdgeIdxPerFace’ may be used uninitialized
# 762 | int i,j,numEdgeIdxPerFace;
# | ^~~~~~~~~~~~~~~~~
# 760| static void fghGenerateGeometryWithIndexArray(int numFaces, int numEdgePerFace, GLfloat *vertices, GLubyte *vertIndices, GLfloat *normals, GLfloat *vertOut, GLfloat *normOut, GLushort *vertIdxOut)
# 761| {
# 762|-> int i,j,numEdgeIdxPerFace;
# 763| GLubyte *vertSamps = NULL;
# 764| switch (numEdgePerFace)
Error: GCC_ANALYZER_WARNING (CWE-416): [#def26]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c: scope_hint: In function ‘fghSierpinskiSpongeGenerate’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1224:36: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘vertices’
# 1222| int vertIdx = tetrahedron_vi[faceIdxVertIdx+j]*3;
# 1223|
# 1224|-> vertices[outIdx ] = (GLfloat)offset[0] + scale * tetrahedron_v[vertIdx ];
# 1225| vertices[outIdx+1] = (GLfloat)offset[1] + scale * tetrahedron_v[vertIdx+1];
# 1226| vertices[outIdx+2] = (GLfloat)offset[2] + scale * tetrahedron_v[vertIdx+2];
Error: GCC_ANALYZER_WARNING (CWE-416): [#def27]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1228:36: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘normals’
# 1226| vertices[outIdx+2] = (GLfloat)offset[2] + scale * tetrahedron_v[vertIdx+2];
# 1227|
# 1228|-> normals [outIdx ] = tetrahedron_n[normIdx ];
# 1229| normals [outIdx+1] = tetrahedron_n[normIdx+1];
# 1230| normals [outIdx+2] = tetrahedron_n[normIdx+2];
Error: CLANG_WARNING: [#def28]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1284:16: warning[core.NullDereference]: Array access results in a null pointer dereference
# 1282|
# 1283| /* Compute cos and sin around the circle */
# 1284|-> (*sint)[0] = 0.0;
# 1285| (*cost)[0] = 1.0;
# 1286|
Error: CLANG_WARNING: [#def29]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1284:16: warning[unix.Malloc]: Use of memory after it is freed
# 1282|
# 1283| /* Compute cos and sin around the circle */
# 1284|-> (*sint)[0] = 0.0;
# 1285| (*cost)[0] = 1.0;
# 1286|
Error: CLANG_WARNING: [#def30]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1346:20: warning[core.NullDereference]: Array access results in a null pointer dereference
# 1344|
# 1345| /* top */
# 1346|-> (*vertices)[0] = 0.f;
# 1347| (*vertices)[1] = 0.f;
# 1348| (*vertices)[2] = radius;
Error: CLANG_WARNING: [#def31]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1346:20: warning[unix.Malloc]: Use of memory after it is freed
# 1344|
# 1345| /* top */
# 1346|-> (*vertices)[0] = 0.f;
# 1347| (*vertices)[1] = 0.f;
# 1348| (*vertices)[2] = radius;
Error: CLANG_WARNING: [#def32]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1440:20: warning[core.NullDereference]: Array access results in a null pointer dereference
# 1438|
# 1439| /* bottom */
# 1440|-> (*vertices)[0] = 0.f;
# 1441| (*vertices)[1] = 0.f;
# 1442| (*vertices)[2] = z;
Error: CLANG_WARNING: [#def33]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1440:20: warning[unix.Malloc]: Use of memory after it is freed
# 1438|
# 1439| /* bottom */
# 1440|-> (*vertices)[0] = 0.f;
# 1441| (*vertices)[1] = 0.f;
# 1442| (*vertices)[2] = z;
Error: CLANG_WARNING: [#def34]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1526:20: warning[core.NullDereference]: Array access results in a null pointer dereference
# 1524| z=0;
# 1525| /* top on Z-axis */
# 1526|-> (*vertices)[0] = 0.f;
# 1527| (*vertices)[1] = 0.f;
# 1528| (*vertices)[2] = 0.f;
Error: CLANG_WARNING: [#def35]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1526:20: warning[unix.Malloc]: Use of memory after it is freed
# 1524| z=0;
# 1525| /* top on Z-axis */
# 1526|-> (*vertices)[0] = 0.f;
# 1527| (*vertices)[1] = 0.f;
# 1528| (*vertices)[2] = 0.f;
Error: CLANG_WARNING: [#def36]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1633:35: warning[core.NullDereference]: Array access results in a null pointer dereference
# 1631| int offset = 3 * ( j * nSides + i ) ;
# 1632|
# 1633|-> (*vertices)[offset ] = cpsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1634| (*vertices)[offset+1] = spsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1635| (*vertices)[offset+2] = sphi[i] * iradius ;
Error: CLANG_WARNING: [#def37]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1633:35: warning[unix.Malloc]: Use of memory after it is freed
# 1631| int offset = 3 * ( j * nSides + i ) ;
# 1632|
# 1633|-> (*vertices)[offset ] = cpsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1634| (*vertices)[offset+1] = spsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1635| (*vertices)[offset+2] = sphi[i] * iradius ;
Error: CLANG_WARNING: [#def38]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1633:67: warning[core.UndefinedBinaryOperatorResult]: The left operand of '*' is a garbage value
# 1631| int offset = 3 * ( j * nSides + i ) ;
# 1632|
# 1633|-> (*vertices)[offset ] = cpsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1634| (*vertices)[offset+1] = spsi[j] * ( oradius + cphi[i] * iradius ) ;
# 1635| (*vertices)[offset+2] = sphi[i] * iradius ;
Error: CLANG_WARNING: [#def39]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1699:25: warning[core.NullDereference]: Array access (from variable 'vertices') results in a null pointer dereference
# 1697|
# 1698| for (i=0; i<CUBE_VERT_ELEM_PER_OBJ; i++)
# 1699|-> vertices[i] = dSize*cube_verts[i];
# 1700| }
# 1701| else
Error: CLANG_WARNING: [#def40]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1714:9: warning[unix.Malloc]: Argument to free() is the address of the global variable 'cube_verts', which is not memory allocated by malloc()
# 1712| if (dSize!=1.f)
# 1713| /* cleanup allocated memory */
# 1714|-> free(vertices);
# 1715| }
# 1716|
Error: CLANG_WARNING: [#def41]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1745:9: warning[unix.Malloc]: Use of memory after it is freed
# 1743|
# 1744| /* Generate elements */
# 1745|-> fghSierpinskiSpongeGenerate ( numLevels, offset, scale, vertices, normals );
# 1746|
# 1747| /* Draw and cleanup */
Error: CLANG_WARNING: [#def42]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1796:31: warning[core.NullDereference]: Array access (from variable 'stackIdx') results in a null pointer dereference
# 1794| for (j=0; j<slices; j++, idx++)
# 1795| {
# 1796|-> stackIdx[idx] = offset+j;
# 1797| }
# 1798| }
Error: CLANG_WARNING: [#def43]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1796:31: warning[unix.Malloc]: Use of memory after it is freed
# 1794| for (j=0; j<slices; j++, idx++)
# 1795| {
# 1796|-> stackIdx[idx] = offset+j;
# 1797| }
# 1798| }
Error: CLANG_WARNING: [#def44]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1804:29: warning[core.NullDereference]: Array access (from variable 'sliceIdx') results in a null pointer dereference
# 1802| {
# 1803| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 1804|-> sliceIdx[idx++] = 0; /* vertex on top */
# 1805| for (j=0; j<stacks-1; j++, idx++)
# 1806| {
Error: CLANG_WARNING: [#def45]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1804:29: warning[unix.Malloc]: Use of memory after it is freed
# 1802| {
# 1803| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 1804|-> sliceIdx[idx++] = 0; /* vertex on top */
# 1805| for (j=0; j<stacks-1; j++, idx++)
# 1806| {
Error: CLANG_WARNING: [#def46]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1813:9: warning[unix.Malloc]: Use of memory after it is freed
# 1811|
# 1812| /* draw */
# 1813|-> fghDrawGeometryWire(vertices,normals,nVert,
# 1814| sliceIdx,slices,stacks+1,GL_LINE_STRIP,
# 1815| stackIdx,stacks-1,slices);
Error: CLANG_WARNING: [#def47]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1922:31: warning[core.NullDereference]: Array access (from variable 'stackIdx') results in a null pointer dereference
# 1920| for (j=0; j<slices; j++, idx++)
# 1921| {
# 1922|-> stackIdx[idx] = offset+j;
# 1923| }
# 1924| }
Error: CLANG_WARNING: [#def48]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1922:31: warning[unix.Malloc]: Use of memory after it is freed
# 1920| for (j=0; j<slices; j++, idx++)
# 1921| {
# 1922|-> stackIdx[idx] = offset+j;
# 1923| }
# 1924| }
Error: CLANG_WARNING: [#def49]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1930:29: warning[core.NullDereference]: Array access (from variable 'sliceIdx') results in a null pointer dereference
# 1928| {
# 1929| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 1930|-> sliceIdx[idx++] = offset+slices;
# 1931| sliceIdx[idx++] = offset+(stacks+1)*slices;
# 1932| }
Error: CLANG_WARNING: [#def50]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1930:29: warning[unix.Malloc]: Use of memory after it is freed
# 1928| {
# 1929| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 1930|-> sliceIdx[idx++] = offset+slices;
# 1931| sliceIdx[idx++] = offset+(stacks+1)*slices;
# 1932| }
Error: CLANG_WARNING: [#def51]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:1935:9: warning[unix.Malloc]: Use of memory after it is freed
# 1933|
# 1934| /* draw */
# 1935|-> fghDrawGeometryWire(vertices,normals,nVert,
# 1936| sliceIdx,1,slices*2,GL_LINES,
# 1937| stackIdx,stacks,slices);
Error: CLANG_WARNING: [#def52]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2033:31: warning[core.NullDereference]: Array access (from variable 'stackIdx') results in a null pointer dereference
# 2031| for (j=0; j<slices; j++, idx++)
# 2032| {
# 2033|-> stackIdx[idx] = offset+j;
# 2034| }
# 2035| }
Error: CLANG_WARNING: [#def53]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2033:31: warning[unix.Malloc]: Use of memory after it is freed
# 2031| for (j=0; j<slices; j++, idx++)
# 2032| {
# 2033|-> stackIdx[idx] = offset+j;
# 2034| }
# 2035| }
Error: CLANG_WARNING: [#def54]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2041:29: warning[core.NullDereference]: Array access (from variable 'sliceIdx') results in a null pointer dereference
# 2039| {
# 2040| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 2041|-> sliceIdx[idx++] = offset+slices;
# 2042| sliceIdx[idx++] = offset+(stacks+1)*slices;
# 2043| }
Error: CLANG_WARNING: [#def55]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2041:29: warning[unix.Malloc]: Use of memory after it is freed
# 2039| {
# 2040| GLushort offset = 1+i; /* start at 1 (0 is top vertex), and we advance one slice as we go along */
# 2041|-> sliceIdx[idx++] = offset+slices;
# 2042| sliceIdx[idx++] = offset+(stacks+1)*slices;
# 2043| }
Error: CLANG_WARNING: [#def56]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2046:9: warning[unix.Malloc]: Use of memory after it is freed
# 2044|
# 2045| /* draw */
# 2046|-> fghDrawGeometryWire(vertices,normals,nVert,
# 2047| sliceIdx,1,slices*2,GL_LINES,
# 2048| stackIdx,stacks+1,slices);
Error: CLANG_WARNING: [#def57]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2191:33: warning[core.NullDereference]: Array access (from variable 'stripIdx') results in a null pointer dereference
# 2189| {
# 2190| int offset = j * nSides + i;
# 2191|-> stripIdx[idx ] = offset;
# 2192| stripIdx[idx+1] = offset + ioff;
# 2193| }
Error: CLANG_WARNING: [#def58]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_geometry.c:2195:29: warning[core.NullDereference]: Array access (from variable 'stripIdx') results in a null pointer dereference
# 2193| }
# 2194| /* repeat first to close off shape */
# 2195|-> stripIdx[idx ] = i;
# 2196| stripIdx[idx+1] = i + ioff;
# 2197| idx +=2;
Error: CLANG_WARNING: [#def59]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_init.c:116:22: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'pargc')
# 114| {
# 115| #ifndef _WIN32_WCE
# 116|-> int i, j, argc = *pargc;
# 117|
# 118| {
Error: CLANG_WARNING: [#def60]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_init.c:138:21: warning[core.NullDereference]: Array access (from variable 'argv') results in a null pointer dereference
# 136| for( i = 1; i < argc; i++ )
# 137| {
# 138|-> if( strcmp( argv[ i ], "-display" ) == 0 )
# 139| {
# 140| if( ++i >= argc )
Error: GCC_ANALYZER_WARNING (CWE-688): [#def61]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_init.c: scope_hint: In function ‘glutInitDisplayString’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_init.c:461:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buffer’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
# 459| size_t len = strlen ( displayMode );
# 460| char *buffer = (char *)malloc ( (len+1) * sizeof(char) );
# 461|-> memcpy ( buffer, displayMode, len );
# 462| buffer[len] = '\0';
# 463|
Error: CLANG_WARNING: [#def62]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c:157:25: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value
# 155| if( axes )
# 156| for( i=0; i<joy->num_axes; i++ )
# 157|-> axes[ i ] = fghJoystickFudgeAxis( joy, raw_axes[ i ], i );
# 158| }
# 159|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def63]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c: scope_hint: In function ‘fghJoystickInit’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c:645:70: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(672, 1)’
# 643|
# 644| /* Set defaults */
# 645|-> fgJoystick[ ident ]->num_axes = fgJoystick[ ident ]->num_buttons = 0;
# 646| fgJoystick[ ident ]->error = GL_TRUE;
# 647|
Error: CLANG_WARNING: [#def64]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c:707:49: warning[core.UndefinedBinaryOperatorResult]: The left operand of '*' is a garbage value
# 705| INVOKE_WCB( *window, Joystick,
# 706| ( buttons,
# 707|-> (int) ( axes[ 0 ] * 1000.0f ),
# 708| (int) ( axes[ 1 ] * 1000.0f ),
# 709| (int) ( axes[ 2 ] * 1000.0f ) )
Error: CLANG_WARNING: [#def65]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c:708:49: warning[core.UndefinedBinaryOperatorResult]: The left operand of '*' is a garbage value
# 706| ( buttons,
# 707| (int) ( axes[ 0 ] * 1000.0f ),
# 708|-> (int) ( axes[ 1 ] * 1000.0f ),
# 709| (int) ( axes[ 2 ] * 1000.0f ) )
# 710| );
Error: CLANG_WARNING: [#def66]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_joystick.c:709:49: warning[core.UndefinedBinaryOperatorResult]: The left operand of '*' is a garbage value
# 707| (int) ( axes[ 0 ] * 1000.0f ),
# 708| (int) ( axes[ 1 ] * 1000.0f ),
# 709|-> (int) ( axes[ 2 ] * 1000.0f ) )
# 710| );
# 711| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def67]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c: scope_hint: In function ‘fghCheckMenuStatus’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:196:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘entry’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:30: included_from: Included from here.
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:193:9: note: in expansion of macro ‘FREEGLUT_INTERNAL_ERROR_EXIT’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:193:9: note: in expansion of macro ‘FREEGLUT_INTERNAL_ERROR_EXIT’
# 194| "fghCheckMenuStatus" );
# 195|
# 196|-> menuEntry->IsActive = GL_TRUE;
# 197| menuEntry->Ordinal = menuID;
# 198|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def68]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c: scope_hint: In function ‘glutAddMenuEntry’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:873:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘menuEntry’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:868:5: note: in expansion of macro ‘freeglut_return_if_fail’
# 871|
# 872| menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
# 873|-> menuEntry->Text = strdup( label );
# 874| menuEntry->ID = value;
# 875|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def69]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c: scope_hint: In function ‘glutAddSubMenu’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:900:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘menuEntry’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:893:5: note: in expansion of macro ‘freeglut_return_if_fail’
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_menu.c:897:5: note: in expansion of macro ‘freeglut_return_if_fail’
# 898|
# 899| menuEntry = ( SFG_MenuEntry * )calloc( sizeof( SFG_MenuEntry ), 1 );
# 900|-> menuEntry->Text = strdup( label );
# 901| menuEntry->SubMenu = subMenu;
# 902| menuEntry->ID = -1;
Error: CLANG_WARNING: [#def70]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_structure.c:89:5: warning[core.NullDereference]: Array access (via field 'CallBacks') results in a null pointer dereference
# 87|
# 88| fghClearCallBacks( window );
# 89|-> SET_WCB( *window, Reshape, fghDefaultReshape, NULL);
# 90|
# 91| /* Initialize the object properties */
Error: CLANG_WARNING: [#def71]
freeglut-3.6.0-build/freeglut-3.6.0/src/fg_structure.c:217:9: warning[unix.Malloc]: Use of memory after it is freed
# 215|
# 216| while( window->Children.First )
# 217|-> fgDestroyWindow( ( SFG_Window * )window->Children.First );
# 218|
# 219| {
Error: CPPCHECK_WARNING: [#def72]
freeglut-3.6.0-build/freeglut-3.6.0/src/util/xparsegeometry_repl.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: COMPILER_WARNING (CWE-1164): [#def73]
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_gamemode_x11.c:35:12: warning[-Wunused-function]: ‘use_xrandr’ defined but not used
# 35 | static int use_xrandr(void)
# | ^~~~~~~~~~
# 33| * hasn't explicitly disabled it by setting the FREEGLUT_NO_XRANDR env-var.
# 34| */
# 35|-> static int use_xrandr(void)
# 36| {
# 37| #ifdef HAVE_X11_EXTENSIONS_XRANDR_H
Error: COMPILER_WARNING (CWE-1164): [#def74]
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_gamemode_x11.c:54:12: warning[-Wunused-function]: ‘use_xf86vm’ defined but not used
# 54 | static int use_xf86vm(void)
# | ^~~~~~~~~~
# 52| * user hasn't explicitly disabled it by setting the FREEGLUT_NO_XF86VM env-var.
# 53| */
# 54|-> static int use_xf86vm(void)
# 55| {
# 56| #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
Error: GCC_ANALYZER_WARNING (CWE-476): [#def75]
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_input_devices_x11.c: scope_hint: In function ‘fg_serial_open’
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_input_devices_x11.c:76:14: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘port’
# 74| port = malloc(sizeof(SERIALPORT));
# 75| memset(port, 0, sizeof(SERIALPORT));
# 76|-> port->fd = fd;
# 77|
# 78| /* save current port settings */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def76]
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_state_x11_glx.c: scope_hint: In function ‘fgPlatformGlutGetModeValues’
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_state_x11_glx.c:232:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘array’
# 230| for (i = 0; i < *size; i++)
# 231| {
# 232|-> array[i] = temp_array[i];
# 233| }
# 234|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def77]
freeglut-3.6.0-build/freeglut-3.6.0/src/x11/fg_state_x11_glx.c:232:36: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘temp_array’
# 230| for (i = 0; i < *size; i++)
# 231| {
# 232|-> array[i] = temp_array[i];
# 233| }
# 234|
Scan Properties
analyzer-version-clang | 18.1.7 |
analyzer-version-cppcheck | 2.14.2 |
analyzer-version-gcc | 14.1.1 |
analyzer-version-gcc-analyzer | 14.1.1 |
analyzer-version-shellcheck | 0.10.0 |
enabled-plugins | clang, cppcheck, gcc, shellcheck |
exit-code | 0 |
host | ip-172-16-1-237.us-west-2.compute.internal |
mock-config | fedora-41-x86_64 |
project-name | freeglut-3.6.0-1.fc41 |
store-results-to | /tmp/tmph73o2xu6/freeglut-3.6.0-1.fc41.tar.xz |
time-created | 2024-07-03 12:39:03 |
time-finished | 2024-07-03 12:40:08 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmph73o2xu6/freeglut-3.6.0-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmph73o2xu6/freeglut-3.6.0-1.fc41.src.rpm' |
tool-version | csmock-3.5.3-1.el9 |