Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

How to debug heap corruption problem?

Vincent_JinVincent_Jin Member Posts: 33
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.

Comments

  • Vincent_JinVincent_Jin Member Posts: 33
    Unfortunately, Special pool can't detect the error...
    It there any other methods?
  • Martin_BurnickiMartin_Burnicki Member - All Emails Posts: 18
    xxxxx@gmail.com wrote:
    > 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.


    Martin
    --
    Martin Burnicki

    Senior Software Engineer

    MEINBERG Funkuhren GmbH & Co. KG
    Email: xxxxx@meinberg.de
    Phone: +49 (0)5281 9309-14
    Linkedin: https://www.linkedin.com/in/martinburnicki/

    Lange Wand 9, 31812 Bad Pyrmont, Germany
    Amtsgericht Hannover 17HRA 100322
    Geschäftsführer/Managing Directors: Günter Meinberg, Werner Meinberg,
    Andre Hartmann, Heiko Gerstung
    Websites: https://www.meinberg.de https://www.meinbergglobal.com
    Training: https://www.meinberg.academy
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!