From 80a615c542fd30bc70703d465bdc3093965a57e2 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 7 Oct 2011 05:56:02 +0000 Subject: [PATCH] rtl: correct error check for encoding methods arguments git-svn-id: trunk@19399 - --- rtl/objpas/sysutils/sysencoding.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtl/objpas/sysutils/sysencoding.inc b/rtl/objpas/sysutils/sysencoding.inc index 9933a515e1..3241694519 100644 --- a/rtl/objpas/sysutils/sysencoding.inc +++ b/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]);