Răsfoiți Sursa

* when the stack size is overestimated so much that it's larger than the
stack pointer (can happen for externally started threads), truncate it
to a legal value (should stop crashes when enabling stack checking on
iOS 6)

git-svn-id: trunk@23320 -

Jonas Maebe 12 ani în urmă
părinte
comite
5f3d762788
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 5 0
      rtl/bsd/system.pp

+ 5 - 0
rtl/bsd/system.pp

@@ -314,7 +314,12 @@ begin
 end;
 
 function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
+var
+  stackpointer: ptruint;
 begin
+  stackpointer := (ptruint(sptr) + 4095) and not(4095);
+  if stklen > stackpointer then
+    stklen := stackpointer-4096;
   result := stklen;
 end;