From 3e271a7c1a91b0b6bc1b6030b18f9b15c83b174b Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 22 Aug 2013 12:40:25 +0000 Subject: [PATCH] [0.2.x] fixed : issue #12068 ( windbg crash at loadWStr(0) ) git-svn-id: https://pykd.svn.codeplex.com/svn@84891 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/win/memory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pykd/win/memory.cpp b/pykd/win/memory.cpp index 78e3499..2d8f89b 100644 --- a/pykd/win/memory.cpp +++ b/pykd/win/memory.cpp @@ -185,6 +185,9 @@ std::wstring loadWStr( ULONG64 offset ) 0, &strLength ); + if ( FAILED( hres ) ) + throw MemoryException( offset ); + std::vector buffer(strLength); hres = @@ -195,8 +198,7 @@ std::wstring loadWStr( ULONG64 offset ) strLength, NULL ); - if ( FAILED( hres ) ) - throw MemoryException( offset ); + return std::wstring( &buffer[0] ); }