An unmanaged pointer is passed to a method of a class in C#. Before manipulating, I need to make sure that the pointer is allocated with the claimed size and is still valid (not freed yet). How is it possible?
Asked
Active
Viewed 98 times
0
-
1You can't. It sounds like the C code is buggy. – Jonathon Reinhart Jun 28 '20 at 14:48
-
Short answer: you can't. Longer answer: https://stackoverflow.com/questions/551069/testing-pointers-for-validity-c-c – Hakej Jun 28 '20 at 14:52
-
In Windows programming, we've some tools like functions like IsBadReadPtr. Can't such tools help? – hamidi Jun 28 '20 at 15:05