Browse Source

* Add range check to trystrtoint

michael 4 years ago
parent
commit
cbcc6c63b8
1 changed files with 1 additions and 4 deletions
  1. 1 4
      packages/rtl/sysutils.pas

+ 1 - 4
packages/rtl/sysutils.pas

@@ -4664,12 +4664,9 @@ Var
 
 
 begin
 begin
   Result:=TryStrToInt(S,NI);
   Result:=TryStrToInt(S,NI);
+  Result:=Result and (-2147483648<=NI) and (NI<=2147483647);
   if Result then
   if Result then
-    begin
     res:=NI;
     res:=NI;
-    if (NI<low(res)) or (NI>high(res)) then
-      Result:=false;
-    end;
 end;
 end;