weixin_39817347 2020-11-30 07:35
浏览 0

Probably-false uninit reports on StackWalk64

From timurrrr.com on August 26, 2011 10:23:09

As of r481 :

include

include

pragma comment(lib, "dbghelp.lib")

include

include

long WINAPI SDEF(EXCEPTION_POINTERS *ep) { STACKFRAME64 stack_frame; memset(&stack_frame, 0, sizeof(stack_frame)); stack_frame.AddrPC.Offset = ep->ContextRecord->Eip; stack_frame.AddrFrame.Offset = ep->ContextRecord->Ebp; stack_frame.AddrStack.Offset = ep->ContextRecord->Esp; stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat; stack_frame.AddrStack.Mode = AddrModeFlat; while (StackWalk64(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &stack_frame, ep->ContextRecord, NULL, &SymFunctionTableAccess64, &SymGetModuleBase64, NULL)) { printf("Frame: 0x%08X\n", stack_frame.AddrPC.Offset); } return 1; }

int main() { SetUnhandledExceptionFilter(&SDEF); throw std::exception("Woo"); }

Error #1: UNINITIALIZED READ: reading 0x0018ea2c-0x0018ea2d 1 byte(s) :00:02.162 in thread 4972 Note: instruction: test 0xffffffb4(%ebp) $0x01 0x73f94c40 dbghelp.dll!SymFromAddrW 0x73f94916 dbghelp.dll!SymFromAddrW 0x73f94f0f dbghelp.dll!SymFromAddrW 0x73f965b1 dbghelp.dll!StackWalk64 0x73f964c8 dbghelp.dll!StackWalk64 0x004010e4 test.exe!SDEF c:\sandbox\stackwalk\test.cpp:20

Original issue: http://code.google.com/p/drmemory/issues/detail?id=567

该提问来源于开源项目:DynamoRIO/drmemory

  • 写回答

7条回答 默认 最新

  • weixin_39817347 2020-11-30 07:35
    关注

    From timurrrr.com on August 26, 2011 07:24:52

    Leaks on a similar program:

    include

    include

    pragma comment(lib, "dbghelp.lib")

    include

    int main() { STACKFRAME64 stack_frame; memset(&stack_frame, 0, sizeof(stack_frame)); CONTEXT cxt; memset(&cxt, 0, sizeof(cxt)); stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat; stack_frame.AddrStack.Mode = AddrModeFlat; while (StackWalk64(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &stack_frame, &cxt, NULL, &SymFunctionTableAccess64, &SymGetModuleBase64, NULL)) { printf("Frame: 0x%08X\n", stack_frame.AddrPC.Offset); } }

    Error #1: LEAK 896 direct bytes 0x002307e0-0x00230b60 + 0 indirect bytes 0x73f8d92e dbghelp.dll!SymGetModuleInfoW64 0x73f94fce dbghelp.dll!SymFromAddrW 0x73f964c8 dbghelp.dll!StackWalk64 0x004010a5 test.exe!main c:\sandbox\stackwalk\test.cpp:18

    评论

报告相同问题?