[Solved] Decompression error when loading png (no issues in other applications). lazarus / 39-Graphics ---------------------------------------------------------------------- Weps · 2019-02-20 04:36 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  p: TPortableNetworkGraphic;begin  p := TPortableNetworkGraphic.Create;  try   p.LoadFromFile( './error.png');   except    on e: exception do begin      showmessage( e.message);    end;  end;  throws a "data error". This is coming from zinflate.pas lines 438-445 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         if (z.state^.sub.check.was <> z.state^.sub.check.need) then        begin          z.state^.mode := BAD;          z.msg := 'incorrect data check';          z.state^.sub.marker := 5;       { can't try inflateSync }          continue;           { break C-switch }        end;  I have no idea why this png would fail. I ran the PNG checker and PNG analyzer, both report no errors. Nor does any other tool so far (browsers, linux). Is this an error in the zlib code of fpc? Or what is going wrong with this png file? (Lazarus 1.8.4 / FPC 3.0.4 / SVN 57952 / win64) ---------------------------------------------------------------------- Weps · 2019-02-20 05:12 It seems there were some changes to the zlib library, and I found this one (eventually): https://bugs.freepascal.org/view.php?id=33493 1.8.4 did not include this fix, I copied it manually, and the png loads correctly. Time to move to 2.0 I suppose... ---------------------------------------------------------------------- zeljko · 2019-02-20 08:26 Lazarus 2.0 won't help in this case. That patch is for fpc-3.2.0 and fpc-trunk ---------------------------------------------------------------------- Weps · 2019-02-20 13:50 Good to know. Thanks.