Explorar o código

fpreadtiff: fixed reading last byte of chunk

git-svn-id: trunk@22256 -
Mattias Gaertner %!s(int64=13) %!d(string=hai) anos
pai
achega
e40505a998
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      packages/fcl-image/src/fpreadtiff.pas

+ 2 - 2
packages/fcl-image/src/fpreadtiff.pas

@@ -2098,7 +2098,7 @@ var
     // read two or three bytes
     if CurBitLength+SrcPosBit>16 then begin
       // read from three bytes
-      if SrcPos+3>Count then Error('LZW stream overrun');
+      if SrcPos+3>=Count then Error('LZW stream overrun');
       v:=PByte(Buffer)[SrcPos];
       inc(SrcPos);
       v:=(v shl 8)+PByte(Buffer)[SrcPos];
@@ -2107,7 +2107,7 @@ var
       v:=v shr (24-CurBitLength-SrcPosBit);
     end else begin
       // read from two bytes
-      if SrcPos+2>Count then Error('LZW stream overrun');
+      if SrcPos+2>=Count then Error('LZW stream overrun');
       v:=PByte(Buffer)[SrcPos];
       inc(SrcPos);
       v:=(v shl 8)+PByte(Buffer)[SrcPos];