mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 11:09:19 +02:00
fpreadtiff: fixed reading last byte of chunk
git-svn-id: trunk@22256 -
This commit is contained in:
parent
33f5de990d
commit
e40505a998
@ -2098,7 +2098,7 @@ var
|
|||||||
// read two or three bytes
|
// read two or three bytes
|
||||||
if CurBitLength+SrcPosBit>16 then begin
|
if CurBitLength+SrcPosBit>16 then begin
|
||||||
// read from three bytes
|
// 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];
|
v:=PByte(Buffer)[SrcPos];
|
||||||
inc(SrcPos);
|
inc(SrcPos);
|
||||||
v:=(v shl 8)+PByte(Buffer)[SrcPos];
|
v:=(v shl 8)+PByte(Buffer)[SrcPos];
|
||||||
@ -2107,7 +2107,7 @@ var
|
|||||||
v:=v shr (24-CurBitLength-SrcPosBit);
|
v:=v shr (24-CurBitLength-SrcPosBit);
|
||||||
end else begin
|
end else begin
|
||||||
// read from two bytes
|
// 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];
|
v:=PByte(Buffer)[SrcPos];
|
||||||
inc(SrcPos);
|
inc(SrcPos);
|
||||||
v:=(v shl 8)+PByte(Buffer)[SrcPos];
|
v:=(v shl 8)+PByte(Buffer)[SrcPos];
|
||||||
|
Loading…
Reference in New Issue
Block a user