I once had to fix a random memory corruption in some X windows code which used a proprietary third party library to which we didn't have the source. After linking with my own malloc/free library that would carefully add lots of guard space around every allocation I discovered that it tended to overwrite an area just past a structure it was responsible for allocating. We reported the bug to the vendor but we had a demo coming up so in the meantime we just wrapped calls to their stuff with some code that swapped in my allocator. Simply allocating 10% more than what the library asked for made the problem go away.
Ooh, those kinds of bugs are evil. I once had a bug in Rivet caused by Apache and Tcl linking to different versions of the same struct, getting confused, and stomping on some memory. It was really a bitch to track down:-/
Comments
I once had to fix a random memory corruption in some X windows code which used a proprietary third party library to which we didn't have the source. After linking with my own malloc/free library that would carefully add lots of guard space around every allocation I discovered that it tended to overwrite an area just past a structure it was responsible for allocating. We reported the bug to the vendor but we had a demo coming up so in the meantime we just wrapped calls to their stuff with some code that swapped in my allocator. Simply allocating 10% more than what the library asked for made the problem go away.
Ooh, those kinds of bugs are evil. I once had a bug in Rivet caused by Apache and Tcl linking to different versions of the same struct, getting confused, and stomping on some memory. It was really a bitch to track down:-/