Przeglądaj źródła

rtl: correct error check for encoding methods arguments

git-svn-id: trunk@19399 -
paul 14 lat temu
rodzic
commit
80a615c542
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      rtl/objpas/sysutils/sysencoding.inc

+ 3 - 3
rtl/objpas/sysutils/sysencoding.inc

@@ -146,7 +146,7 @@ end;
 function TEncoding.GetByteCount(const Chars: TUnicodeCharArray; CharIndex,
   CharCount: Integer): Integer;
 begin
-  if (CharCount < 0) or (Length(Chars) <= CharCount + CharIndex) then
+  if (CharCount < 0) or (Length(Chars) < CharCount + CharIndex) then
     raise EEncodingError.CreateFmt(SInvalidCount, [CharCount]);
   if (CharIndex < 0) then
     raise EEncodingError.CreateFmt(SCharacterIndexOutOfBounds, [CharIndex]);
@@ -176,7 +176,7 @@ end;
 function TEncoding.GetBytes(const Chars: TUnicodeCharArray; CharIndex,
   CharCount: Integer): TBytes;
 begin
-  if (CharCount < 0) or (Length(Chars) <= CharCount + CharIndex) then
+  if (CharCount < 0) or (Length(Chars) < CharCount + CharIndex) then
     raise EEncodingError.CreateFmt(SInvalidCount, [CharCount]);
   if (CharIndex < 0) then
     raise EEncodingError.CreateFmt(SCharacterIndexOutOfBounds, [CharIndex]);
@@ -194,7 +194,7 @@ begin
     raise EEncodingError.Create(SInvalidDestinationArray);
   if (ByteIndex < 0) or (ByteLen < ByteIndex) then
     raise EEncodingError.CreateFmt(SInvalidDestinationIndex, [ByteIndex]);
-  if (CharCount < 0) or (Length(Chars) <= CharCount + CharIndex) then
+  if (CharCount < 0) or (Length(Chars) < CharCount + CharIndex) then
     raise EEncodingError.CreateFmt(SInvalidCount, [CharCount]);
   if (CharIndex < 0) then
     raise EEncodingError.CreateFmt(SCharacterIndexOutOfBounds, [CharIndex]);