From ad7111ad4d442b01fe5e492f81d16bd11142679b Mon Sep 17 00:00:00 2001 From: nickysn Date: Sun, 14 Sep 2014 14:47:13 +0000 Subject: [PATCH] * SysTinyFreeMem: terminate with a runtime error if Addr is >= HeapPtr, since InternalTinyFreeMem cannot handle that (which causes heap corruption), and it indicates a bug in the program anyway, because the area between HeapPtr and HeapEnd is free (so it indicates either a double free or freeing an invalid pointer). git-svn-id: trunk@28658 - --- rtl/inc/tinyheap.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtl/inc/tinyheap.inc b/rtl/inc/tinyheap.inc index 89d9d6508b..e94e6bd54b 100644 --- a/rtl/inc/tinyheap.inc +++ b/rtl/inc/tinyheap.inc @@ -237,7 +237,7 @@ exit; end; if (TTinyHeapPointerArithmeticType(addr) < TTinyHeapPointerArithmeticType(HeapOrg)) or - (TTinyHeapPointerArithmeticType(addr) >= TTinyHeapPointerArithmeticType(HeapEnd)) then + (TTinyHeapPointerArithmeticType(addr) >= TTinyHeapPointerArithmeticType(HeapPtr)) then HandleError(204); sz := Align(FindSize(addr)+SizeOf(TTinyHeapMemBlockSize), TinyHeapAllocGranularity);