Most efficient replacement for IsBadReadPtr?

前端 未结 10 1259
你的背包
你的背包 2020-12-06 06:45

I have some Visual C++ code that receives a pointer to a buffer with data that needs to be processed by my code and the length of that buffer. Due to a bug outside my contro

10条回答
  •  感情败类
    2020-12-06 07:41

    If the variable is uninitialized you are hosed. Sooner or later it's going to be an address for something you don't want to play with (like your own stack).

    If you think you need this, and (uintptr_t)var < 65536 does not suffice (Windows does not allow allocating the bottom 64k), there is no real solution. VirtualQuery, etc. appear to "work" but sooner or later will burn you.

提交回复
热议问题