Explorar el Código

Avoid wrap on 32-bit system for StackTop calculation

git-svn-id: trunk@39735 -
pierre hace 7 años
padre
commit
16e2bdad5a
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      rtl/inc/system.inc

+ 5 - 1
rtl/inc/system.inc

@@ -717,7 +717,11 @@ End;
 {$ifndef FPC_SYSTEM_HAS_STACKTOP}
 function StackTop: pointer;
 begin
-  result:=StackBottom+StackLength;
+  { Avoid wrap to zero on 32-bit }
+  if ptruint(StackBottom)+ StackLength > high(ptruint) then
+    result:=pointer(ptruint(high(ptruint)))
+  else
+    result:=StackBottom + StackLength;
 end;
 {$endif FPC_SYSTEM_HAS_STACKTOP}