From 1f8952f5facccefdd10e4ab1f13ce3abac183216 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 13 Jun 2014 20:51:05 +1000 Subject: [PATCH] RT #94717 libpng 1.6.10 no longer considers CRC errors benign MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use a different badness for checking benign error support Petr Pisar: Ported to 0.98. Signed-off-by: Petr Písař --- MANIFEST | 1 + PNG/t/10png.t | 22 ++++++++++++++++++---- PNG/testimg/bipalette.png | Bin 0 -> 129 bytes 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 PNG/testimg/bipalette.png diff --git a/MANIFEST b/MANIFEST index 2723a3b..7bb8921 100644 --- a/MANIFEST +++ b/MANIFEST @@ -240,6 +240,7 @@ PNG/t/00load.t PNG/t/10png.t Test png support PNG/testimg/badcrc.png PNG/testimg/bilevel.png +PNG/testimg/bipalette.png bi-level but with a palette PNG/testimg/comment.png PNG/testimg/cover.png PNG/testimg/cover16.png diff --git a/PNG/t/10png.t b/PNG/t/10png.t index bc109d7..b9365e4 100644 --- a/PNG/t/10png.t +++ b/PNG/t/10png.t @@ -10,7 +10,7 @@ my $debug_writes = 1; init_log("testout/t102png.log",1); -plan tests => 249; +plan tests => 251; # this loads Imager::File::PNG too ok($Imager::formats{"png"}, "must have png format"); @@ -183,11 +183,25 @@ EOS SKIP: { # ignoring "benign" errors $png_feat{"benign-errors"} - or skip "libpng not configured for benign error support", 1; + or skip "libpng not configured for benign error support", 3; + + SKIP: + { + Imager::File::PNG::i_png_lib_version() < 10610 + or skip "1.6.10 and later treat CRC errors as non-benign", 1; + my $im = Imager->new; + ok($im->read(file => "testimg/badcrc.png", type => "png", + png_ignore_benign_errors => 1), + "read bad crc with png_ignore_benign_errors"); + } + my $im = Imager->new; - ok($im->read(file => "testimg/badcrc.png", type => "png", + ok($im->read(file => "testimg/bipalette.png", type => "png", png_ignore_benign_errors => 1), - "read bad crc with png_ignore_benign_errors"); + "read grey image with palette with png_ignore_benign_errors"); + ok(!$im->read(file => "testimg/bipalette.png", type => "png", + png_ignore_benign_errors => 0), + "read grey image with palette without png_ignore_benign_errors should fail"); } { # write error reporting diff --git a/PNG/testimg/bipalette.png b/PNG/testimg/bipalette.png new file mode 100644 index 0000000000000000000000000000000000000000..b105e44bb7ba2a61fa159b53b12751afa2b08803 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^Od!k%Bp9O38gv3Fg8-ipS0K&7!670dqNu27XlUr? z=T}}{zF@(Ey?ghbJ9qBdwQKk8-FyE0`TO_pzkmP!|NsAeyACb|>f!NpaSY*@nOu;N a!N9=i!f-G@-S7cWoWax8&t;ucLK6UHp)BbD literal 0 HcmV?d00001 -- 1.9.3