Author: tfaber
Date: Sat Dec 24 22:45:26 2011
New Revision: 54749
URL:
http://svn.reactos.org/svn/reactos?rev=54749&view=rev
Log:
[RTL]
- ASSERT on damaged heap data structures instead of producing an infinite loop
See issue #5857 for more details.
Modified:
trunk/reactos/lib/rtl/heap.c
Modified: trunk/reactos/lib/rtl/heap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.c?rev=54749&a…
==============================================================================
--- trunk/reactos/lib/rtl/heap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heap.c [iso-8859-1] Sat Dec 24 22:45:26 2011
@@ -669,6 +669,7 @@
while (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY))
{
+ ASSERT(LastEntry->Size != 0);
LastEntry += LastEntry->Size;
}
ASSERT((LastEntry + LastEntry->Size) == FirstEntry);
@@ -683,7 +684,7 @@
DPRINT("Updating UcrDescriptor %p, new Address %p, size %d\n",
UcrDescriptor, UcrDescriptor->Address, UcrDescriptor->Size);
- /* Set various first entry fields*/
+ /* Set various first entry fields */
FirstEntry->SegmentOffset = LastEntry->SegmentOffset;
FirstEntry->Size = (USHORT)(*Size >> HEAP_ENTRY_SHIFT);
FirstEntry->PreviousSize = LastEntry->Size;