Here are some example misses, all taken from a real project I had to clean up: Bugs that could (maybe?) be found by static analysis, but not found by CPPcheck. Bug 1 // ABS macro was wrongly coded: // #define ABS(X) ((X >= 0) ? X : ((-1)*X)) // ABS(a-b) => ((a-b >= 0) ? a-b : ((-1)*a-b) => (((a-b)>= 0) ? (a-b) : (-1*a)-b) // rewriting with C-language operator precedence... WRONG RESULT ^^^^^^^^^^ // recoded correctly: #define ABS(X) (((X) >= 0) ? (X) : ((-1)*(X))) Bug 2 // Use of uint8_t 0xFF as...
Here are some example misses, all taken from a real project I had to clean up: Bugs that could (maybe?) be found by static analysis, but not found by CPPcheck. // ABS macro was wrongly coded: // #define ABS(X) ((X >= 0) ? X : ((-1)*X)) // ABS(a-b) => ((a-b >= 0) ? a-b : ((-1)*a-b) => (((a-b)>= 0) ? (a-b) : (-1*a)-b) // rewriting with C-language operator precedence... WRONG RESULT ^^^^^^^^^^ // recoded correctly: #define ABS(X) (((X) >= 0) ? (X) : ((-1)*(X))) // Use of uint8_t 0xFF as subscript to...
Thanks Alexander! Very nice '42' ;-)
Here are some example misses, all taken from a real project I had to clean up: Bugs that could (maybe?) be found by static analysis, but not found by CPPcheck. // ABS macro was wrongly coded: // #define ABS(X) ((X >= 0) ? X : ((-1)X)) // ABS(a-b) => ((a-b >= 0) ? a-b : ((-1)a-b) => (((a-b)>= 0) ? (a-b) : (-1*a)-b) // rewriting with C-language operator precedence... WRONG RESULT ^^^^^^^^^^ // recoded correctly: define ABS(X) (((X) >= 0) ? (X) : ((-1)*(X))) // Use of uint8_t 0xFF as subscript to array...
Here are some example misses: Bugs that could (maybe?) be found by static analysis, but not found by CPPcheck. // ABS macro was wrongly coded: // #define ABS(X) ((X >= 0) ? X : ((-1)X)) // ABS(a-b) => ((a-b >= 0) ? a-b : ((-1)a-b) => (((a-b)>= 0) ? (a-b) : (-1*a)-b) // rewriting with C-language operator precedence... WRONG RESULT ^^^^^^^^^^ // recoded correctly: define ABS(X) (((X) >= 0) ? (X) : ((-1)*(X))) // Use of uint8_t 0xFF as subscript to array of 16 entries: if (selectedAlarm != 0xff) { drawBigClimbrate(alarms[selectedAlarm]->climbRate,...
Another case; both lines storing into buffer flagged: if (rxPos >= (sizeof(rxLine) - 1)) break; // buffer overflow rxLine[rxPos++] = rxData; rxLine[rxPos] = 0; (error) Array index out of bounds, cannot determine that rxPos++ is less than 101 [bughuntingArrayIndexOutOfBounds] (error) Array index out of bounds, cannot determine that rxPos is less than 101 [bughuntingArrayIndexOutOfBounds] HTH! Best Regards, Dave Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype Dave.Nadler1
I got a bazillion of these (for an extremely common pattern in many projects): memset(alarmObjects, 0, sizeof(alarmObjects)); (error) Buffer read/write, when calling 'memset' it cannot be determined that 1st argument is not overflowed [bughuntingBufferOverflow] HTH! Best Regards, Dave -- Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype Dave.Nadler1
Sure - Do you prefer I post here or set up on trac? Whatever is easiest for you...
I tried CPPcheck on a 15k LOC AVR embedded project which I recently had to fix. Tried it on the original sources: - did identify some dogy coding, thanks! - very few false positives, thanks! - missed some egregious errors - how best to report? - reports functions not used, that are in fact used. What's your preferred method of reporting problems? Unfortunately the sources are proprietary and require AVR libraries etc. Thanks! Best Regards, Dave -- Dave Nadler, USA East Coast voice (978) 263-0097,...
Service can not START under current Windows 10 x64
Apologies, I forgot that, haven't needed this for a few years... I tried Ext2Fsd-0.69, but its service won't start. Seems NFG for current Windows 10. See: https://sourceforge.net/p/ext2fsd/support-requests/ The driver I formerly used under Windows 7/8 is Ext2IFS_1_12. If you set the setup program's compatibility mode to Vista and run as administrator, the install program crashes/hangs windows, but it seems to actually install despite that! Aaarrrggg... So a few reboots later I've finally got it......
EXT2 image won't mount unders Windows 10