View Issue Details

IDProjectCategoryView StatusLast Update
0036998FPCFCLpublic2020-04-30 15:39
ReporterOndrej Pokorny Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version3.3.1 
Summary0036998: FPReadTiff: "LZW code out of bounds" on valid file + patch
DescriptionI get a "LZW code out of bounds" error on a valid file.

The TIFF image is quite big, so I uploaded it to google drive instead of here:
https://drive.google.com/open?id=1zU3207DB7fxeTxXM693CZN0zY0WstIjP
Steps To Reproduceprogram Project1;
uses
  FPReadTiff, FPImage;
var
  xBmp: TFPCustomImage;
begin
  xBmp := TFPMemoryImage.Create(0, 0);
  xBmp.LoadFromFile('test.tif');
  xBmp.Free;
end.
Additional InformationThe simple patch fixes it for me - I just deactivate (comment out) the out-of-bounds error and everything is read correctly.
TagsNo tags attached.
Fixed in Revision45190
FPCOldBugId
FPCTarget4.0.0
Attached Files

Activities

Ondrej Pokorny

2020-04-30 12:50

developer  

fpreadtiff-01.patch (640 bytes)   
Index: packages/fcl-image/src/fpreadtiff.pas
===================================================================
--- packages/fcl-image/src/fpreadtiff.pas	(revision 44877)
+++ packages/fcl-image/src/fpreadtiff.pas	(working copy)
@@ -2373,7 +2373,7 @@
           if OldCode <> NoCode then
             AddStringToTable(OldCode,Code);
           OldCode:=Code;
-        end else if (Code=TableCount+258) and (OldCode <> NoCode) then begin
+        end else if {(Code=TableCount+258) and} (OldCode <> NoCode) then begin
           WriteStringFromCode(OldCode,true);
           AddStringToTable(OldCode,OldCode);
           OldCode:=Code;
fpreadtiff-01.patch (640 bytes)   

Michael Van Canneyt

2020-04-30 15:39

administrator   ~0122563

Checked and applied, thanks !

Issue History

Date Modified Username Field Change
2020-04-30 12:50 Ondrej Pokorny New Issue
2020-04-30 12:50 Ondrej Pokorny File Added: fpreadtiff-01.patch
2020-04-30 15:39 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-04-30 15:39 Michael Van Canneyt Status new => resolved
2020-04-30 15:39 Michael Van Canneyt Resolution open => fixed
2020-04-30 15:39 Michael Van Canneyt Fixed in Version => 3.3.1
2020-04-30 15:39 Michael Van Canneyt Fixed in Revision => 45190
2020-04-30 15:39 Michael Van Canneyt FPCTarget => 4.0.0
2020-04-30 15:39 Michael Van Canneyt Note Added: 0122563