Heap corruption: What could the cause be?

后端 未结 13 1459
时光取名叫无心
时光取名叫无心 2020-12-25 12:56

I am investigating a crash due to heap corruption. As this issue is non-trivial and involves analyzing the stack and dump results, I have decided to do a code review of file

相关标签:
13条回答
  • 2020-12-25 13:45

    These are the HeapAlloc fuction syntax.

    LPVOID WINAPI HeapAlloc(
      _In_ HANDLE hHeap,
      _In_ DWORD  dwFlags,
      _In_ SIZE_T dwBytes
    );
    

    Here dwFlags paramater can have either HEAP_GENERATE_EXCEPTIONS or HEAP_NO_SERIALIZE or HEAP_ZERO_MEMORY.

    In our file we have to check the flags which we have set. If we have set the flag value as HEAP_NO_SERIALIZE then there will be no serialization which means multiple thread will access the resources which may cause memory corruption.

    "Setting the HEAP_NO_SERIALIZE value eliminates mutual exclusion on the heap. Without serialization, two or more threads that use the same heap handle might attempt to allocate or free memory simultaneously, likely causing corruption in the heap."

    so I think due to the memory corruption in the heap, the node got crashed.

    0 讨论(0)
提交回复
热议问题