Malcolm: Improvements to static analysis in the GCC 13 compiler
David Malcolm writesabout a number of new features that have been added to the staticanalyzer in the GCC 13 release.
The above example makes the common mistake with C-style strings offorgetting the null terminator when computing how much space toallocate for str.GCC 13's -fanalyzer option now keeps track of the sizes ofdynamically allocated buffers, and for many cases it checks thesimulated memory reads and writes against the sizes of the relevantbuffers. With this new work it detects the above problem.