Usage detection after free () on windows. (dangling pointers)

I am trying to detect "Use after free ()" errors, otherwise called "Hanging Pointers". I know that Valgrind can be used to detect "Use after free" errors on the * nix platform, but what about windows? What if I do not have a source? Is there a more efficient program than Valgrind to detect all dangling pointers in a program? Free and open source will be preferred, but I will use a commercial solution if it does its job.

+3
source share
9 answers

The MSVC debugging memory allocator is already doing this. When you get 0xfeeefeee from dereferencing a pointer, you are dangling. With some luck that will bomb the program.

+5
source

You can use gflags.exeand Debugging Tools for the Windows , to include the heap verification process:

It has been a while since I used this, and I honestly can't remember how well it interacts with the C heap runtime, unlike the Windows heap manager (to ensure that every malloc()/ free()/ new/ deletecall is individually checked )

Free but not open source.

+5
source

, Valgrind, Microsoft Application Verifier Windows. API, , - :)

+3

Purify . , , .

+2

. CheckPointer, C. , Wndows.

+1

NuMega BoundsChecker . , , ...

0
source

DieHard is another alternative worth paying attention to. This is on the HOARDE website, which unfortunately seems to use frames, so you need to look in the left navigation to find DieHard.

0
source

Mark a bunch of Windows debugging . This is not open source, but works.

0
source

After free () set the pointer to 0 and wait for the fireworks?

0
source

Source: https://habr.com/ru/post/1736725/


All Articles