Browse Source

* 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 years ago
parent
commit
5f3d762788
1 changed files with 5 additions and 0 deletions
  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;