Attribute malloc

Detecting memory management bugs with GCC 11, Part 1: Understanding dynamic allocation

Detecting memory management bugs with GCC 11, Part 1: Understanding dynamic allocation

Memory management bugs are among the hardest to find in C and C++ programs, and are a favorite target of exploits. These errors are difficult to debug because they involve three distinct sites in a program that are often far apart and obscured by the use of pointers: memory allocation, the use of the allocated memory, and the release of memory back to the system by deallocation. In this two-part article, we’ll look at GNU Compiler Collection (GCC) 11 enhancements that help detect the subset of these bugs that affect dynamically allocated memory. The enhancements discussed here have been made to the GCC core. Related improvements to the GCC static analyzer are covered by David Malcolm in his article Static analysis updates in GCC 11.

Continue reading Detecting memory management bugs with GCC 11, Part 1: Understanding dynamic allocation

Share