From: Tony Cook Date: Mon, 28 Feb 2005 06:56:27 +0000 (+0000) Subject: - reading an image with an idstring of 128 or more bytes would result X-Git-Tag: Imager-0.48^2~214 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/b96be9318c7dfee31e0fe331703b07e5362cf6f6?ds=sidebyside - reading an image with an idstring of 128 or more bytes would result in an allocation error, if the platform char type was signed - tests now check that tga tags are set --- diff --git a/Changes b/Changes index 69746007..f9a2e162 100644 --- a/Changes +++ b/Changes @@ -1020,6 +1020,9 @@ Revision history for Perl extension Imager. http://rt.cpan.org/NoAuth/Bug.html?id=11431 - added reference list of crop() parameters. http://rt.cpan.org/NoAuth/Bug.html?id=11430 +- reading an image with an idstring of 128 or more bytes would result + in an allocation error, if the platform char type was signed +- tests now check that tga tags are set ================================================================= diff --git a/t/t108tga.t b/t/t108tga.t index 2a06786f..437f0f17 100644 --- a/t/t108tga.t +++ b/t/t108tga.t @@ -1,5 +1,5 @@ #!perl -w -print "1..17\n"; +print "1..21\n"; use Imager qw(:all); use strict; BEGIN { require "t/testtools.pl"; } @@ -70,6 +70,17 @@ if ($imoo->write(file=>'testout/t108_oo.tga')) { my ($type) = $imoo->tags(name=>'i_format'); isn(17, $type, 'tga', "check i_format tag"); +# in 0.44 and earlier, reading an image with an idstring of 128 or more +# bytes would result in an allocation error, if the platform char type +# was signed +$imoo = Imager->new; +okn(18, $imoo->read(file=>'testimg/longid.tga'), "read long id image"); +my ($id) = $imoo->tags(name=>'tga_idstring'); +isn(19, $id, "X" x 128, "check tga_idstring tag"); +my ($bitspp) = $imoo->tags(name=>'tga_bitspp'); +isn(20, $bitspp, 24, "check tga_bitspp tag"); +my ($compressed) = $imoo->tags(name=>'compressed'); +isn(21, $compressed, 1, "check compressed tag"); sub write_test { my ($test_num, $im, $filename, $wierdpack, $compress, $idstring) = @_; diff --git a/tga.c b/tga.c index 36ef7dc7..00be8302 100644 --- a/tga.c +++ b/tga.c @@ -38,7 +38,7 @@ Some of these functions are internal. typedef struct { - char idlength; + unsigned char idlength; char colourmaptype; char datatypecode; short int colourmaporigin;