How it's possible that sub instruction cause invalid pointer read?

Viewed 634

I have a crash dump with this code:

mov     r11,rsp
push    rdi
sub     rsp,0A0h
mov     qword ptr [rsp+30h],0FFFFFFFFFFFFFFFEh

It's a prologue of a function. So, !analyze -v says INVALID_POINTER_READ with instruction sub. AMD instructions set says that sub instruction cannot produce any exceptions if argument isn't a memory pointer.

Also, READ_ADDRESS is ffffffffffffffff, but in registers window I can see that rsp is 12b3e0. And this is 32-bit application in 64-bit OS.

I want to know about a possible reasons of this error and how to fix it.

UPD:

Method is std._Tree.insert(const value_type& _Val) in Microsoft Visual Studio 9.0\VC\include\xtree.

Compiler is cl.exe from Visual Studio 2008 installation, 32-bit, version 15.00.30729.01.

Command line:

 /FD /EHsc /MD /GS- /Zc:wchar_t- /Yu"stdafx.h"/W3 /WX /nologo /c /Zi /TP /wd4250 /FI -Zm200 -MP -w34100 -w34189

Linker is from the same source, version 9.00.30729.01.

UPD: for those who have a sceptical views on debugging 32-bit apps with 64-bit debuggers, I have ran a 32-bit version of a debugger and got the same results. So, I still think that it's sub instruction.

UPD: to clarify: the application is built for 32-bit platform. But the processor and Operation System is 64-bit. So, there is nothing strange that in the dump we can see 64-bit registers with 32-bit values.

1 Answers
Related