Re:Careful with that Buffer
by 0x0 on Tuesday September 23, 2014 @05:26AM
(#8354630)
Wasn't this the case with older compilers not zeroing padding space too?
[ Parent
| on HN ]
Hell, old compilers? Even modern compilers don't do that. I once fixed a bug that occurred because someone was doing a memcmp() between two structures to check if they were the same, and it was returning false because some of the padding between variables differed between the two. This was in C++ in a modern version of Visual Studio.
That's not so unreasonable within the process' own heap. I was thinking more about padding inside .exe files on disk with the risk of redistributing that - either from nonzeroed drive slack or from random memory at build time (ms-dos/win95?)