From aa885e24d7df819c33e9241ecfc9604acec8c488 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 24 Dec 2011 22:45:26 +0000 Subject: [PATCH] [RTL] - ASSERT on damaged heap data structures instead of producing an infinite loop See issue #5857 for more details. svn path=/trunk/; revision=54749 --- reactos/lib/rtl/heap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/lib/rtl/heap.c b/reactos/lib/rtl/heap.c index 7cf956eddd0..d97baa3239f 100644 --- a/reactos/lib/rtl/heap.c +++ b/reactos/lib/rtl/heap.c @@ -669,6 +669,7 @@ RtlpFindAndCommitPages(PHEAP Heap, while (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY)) { + ASSERT(LastEntry->Size != 0); LastEntry += LastEntry->Size; } ASSERT((LastEntry + LastEntry->Size) == FirstEntry); @@ -683,7 +684,7 @@ RtlpFindAndCommitPages(PHEAP Heap, 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;