10

我们有一个 DLL,我们丢失了它的源代码,所以我试图通过 IDA Dissembler 弄清楚它是如何工作的。但是似乎有我无法访问的功能,因为我收到以下错误:

Decompilation failure:
46AFAF: positive sp value has been found

在 IDA 网站上查看它有这样的说法:

The stack pointer at the specified address is higher than the initial stack pointer.
Functions behaving so strangely can not be decompiled. If you see that the stack
pointer values are incorrect, modify them with the Alt-K (Edit, Functions, Change
stack pointer) command in IDA. 

http://www.hex-rays.com/products/decompiler/manual/failures.shtml#04

由于我是整个 Dissembling 场景的新手,任何人都能够提供更多关于导致堆栈指针高于初始堆栈指针的原因以及这是否可以修复的信息。谢谢你的时间

4

1 回答 1

20

这通常发生在一个函数有多个返回时,而 ida 没有捕捉到这一点。解决方案是使用 alt-k 将堆栈指针偏移量更改回所需的值。

ARM 代码示例:

.text:00012A10                 MOV     R0, #1          ; -0xd0 + 0
.text:00012A14                 ADD     SP, SP, #0xC8   ; -0xd0 + 0xc8
.text:00012A18                 LDMFD   SP!, {R4,PC}    ; -0x08 - 0xc8 <<< modified
.text:00012A1C ; ---------------------------------------------------------------------------
.text:00012A1C
.text:00012A1C loc_12A1C                               ; CODE XREF: sub_129E4+20j
.text:00012A1C                 MOV     R3, #0          ; -0xd0 + 0

在评论中我写了 alt-k 值。在 0x12A18 处,sp 偏移量重新调整回 -0xd0

于 2012-04-16T14:01:20.420 回答