mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[RTL/x64] Fix a bug in RtlpUnwindInternal
Check if the stack pointer is out of bounds, before trying to unwind a frame. This will not fix any crashes, but it prevents simple crashes from going into a recursive exception.
This commit is contained in:
parent
160bc8a0ce
commit
daf557b245
1 changed files with 17 additions and 0 deletions
|
@ -649,6 +649,18 @@ Exit:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static __inline
|
||||
BOOL
|
||||
RtlpIsStackPointerValid(
|
||||
_In_ ULONG64 StackPointer,
|
||||
_In_ ULONG64 LowLimit,
|
||||
_In_ ULONG64 HighLimit)
|
||||
{
|
||||
return (StackPointer >= LowLimit) &&
|
||||
(StackPointer < HighLimit) &&
|
||||
((StackPointer & 7) == 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
\remark The implementation is based on the description in this blog: http://www.nynaeve.net/?p=106
|
||||
|
||||
|
@ -699,6 +711,11 @@ RtlpUnwindInternal(
|
|||
/* Start looping */
|
||||
while (TRUE)
|
||||
{
|
||||
if (!RtlpIsStackPointerValid(UnwindContext.Rsp, StackLow, StackHigh))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Lookup the FunctionEntry for the current RIP */
|
||||
FunctionEntry = RtlLookupFunctionEntry(UnwindContext.Rip, &ImageBase, NULL);
|
||||
if (FunctionEntry == NULL)
|
||||
|
|
Loading…
Reference in a new issue