Преглед изворни кода

+ check whether the pointer passed to SysTinyReAllocMem is within the heap area
(the same check used as in SysTinyFreeMem)

git-svn-id: trunk@28721 -

nickysn пре 10 година
родитељ
комит
e9dc9735a0
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      rtl/inc/tinyheap.inc

+ 3 - 0
rtl/inc/tinyheap.inc

@@ -277,6 +277,9 @@
           end
         else
           begin
+            if (TTinyHeapPointerArithmeticType(p) < TTinyHeapPointerArithmeticType(HeapOrg)) or
+               (TTinyHeapPointerArithmeticType(p) >= TTinyHeapPointerArithmeticType(HeapPtr)) then
+              HandleError(204);
             oldsize := FindSize(p);
             OldAllocSize := align(oldsize+sizeof(TTinyHeapMemBlockSize), TinyHeapAllocGranularity);
             NewAllocSize := align(size+sizeof(TTinyHeapMemBlockSize), TinyHeapAllocGranularity);