I’m debugging a storport driver. There’s a heap corruption when I try to format the storage device. It’s only a check afterward. Is there any method to find out when the real heap corruption happens?
It’s also very strange to this storport driver. When I use fio to test the raw disk, It works fine. But when I use the management tool to format the disk, it reports heap corruption.
Unfortunately, Special pool can’t detect the error…
It there any other methods?
No idea how to detect the real location of the error automatically, and
haven’t tried things like “special pool”, yet.
However, doesn’t this sound like a kind of buffer overflow?
I had a similar problem with some code like this:
SOME_STRUCURE *p;
p = malloc( sizeof( p ) ); // wrong: size of the pointer only
-vs-
p = malloc( sizeof( *p ) ); // correct size of the buffer
Erroneously typed “sizeof( p )” instead of “sizeof( *p )”, so only the
size of a pointer got allocated instead of the real size of the
structure. So when another structure was copied to the allocated one
some bytes were written beyond the allocated buffer.
Eventually there’s something similar in your code. Just an idea.