Browse Source

* 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 -

nickysn 11 years ago
parent
commit
ad7111ad4d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      rtl/inc/tinyheap.inc

+ 1 - 1
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);