Sfoglia il codice sorgente

fixed trystrtoint checking bounds

mattias 4 anni fa
parent
commit
d72e3a0770
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      packages/rtl/sysutils.pas

+ 4 - 0
packages/rtl/sysutils.pas

@@ -4403,7 +4403,11 @@ Var
 begin
 begin
   Result:=TryStrToInt(S,NI);
   Result:=TryStrToInt(S,NI);
   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;
 
 
 function TryStrToInt(const S: String; out res: NativeInt): Boolean;
 function TryStrToInt(const S: String; out res: NativeInt): Boolean;