From 4593278bee259621fd226213e4d5fc12ba2d4862 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 use a different badness for checking benign error support --- MANIFEST | 1 + PNG/MANIFEST | 1 + PNG/PNG.pm | 2 +- PNG/t/10png.t | 22 ++++++++++++++++++---- PNG/testimg/bipalette.png | Bin 0 -> 129 bytes 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 PNG/testimg/bipalette.png diff --git a/MANIFEST b/MANIFEST index 1149afc8..f832eedb 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/MANIFEST b/PNG/MANIFEST index 08579200..feec471e 100644 --- a/PNG/MANIFEST +++ b/PNG/MANIFEST @@ -12,6 +12,7 @@ t/00load.t t/10png.t testimg/badcrc.png testimg/bilevel.png +testimg/bipalette.png bi-level but with a palette testimg/comment.png testimg/cover.png testimg/cover16.png diff --git a/PNG/PNG.pm b/PNG/PNG.pm index 23fe0754..15da00fe 100644 --- a/PNG/PNG.pm +++ b/PNG/PNG.pm @@ -4,7 +4,7 @@ use Imager; use vars qw($VERSION @ISA); BEGIN { - $VERSION = "0.89"; + $VERSION = "0.90"; require XSLoader; XSLoader::load('Imager::File::PNG', $VERSION); diff --git a/PNG/t/10png.t b/PNG/t/10png.t index bc109d72..b9365e46 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 -- 2.39.5