]> git.imager.perl.org - imager.git/commitdiff
- reading an image with an idstring of 128 or more bytes would result
authorTony Cook <tony@develop=help.com>
Mon, 28 Feb 2005 06:56:27 +0000 (06:56 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 28 Feb 2005 06:56:27 +0000 (06:56 +0000)
  in an allocation error, if the platform char type was signed
- tests now check that tga tags are set

Changes
t/t108tga.t
tga.c

diff --git a/Changes b/Changes
index 69746007f14536fd3f607918ab6b62cccdc0e013..f9a2e1623a63dbd571bc48f177d6924d2985d5b9 100644 (file)
--- 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
   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
 
 =================================================================
 
 
 =================================================================
 
index 2a06786f7ca707b734d3f8eb0da685b8147e6f0c..437f0f17a1c90d94ea6273e6fbfa66bccef6fc48 100644 (file)
@@ -1,5 +1,5 @@
 #!perl -w
 #!perl -w
-print "1..17\n";
+print "1..21\n";
 use Imager qw(:all);
 use strict;
 BEGIN { require "t/testtools.pl"; }
 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");
 
 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) = @_;
 
 sub write_test {
   my ($test_num, $im, $filename, $wierdpack, $compress, $idstring) = @_;
diff --git a/tga.c b/tga.c
index 36ef7dc72ad43954f0ac4da876299b3d0e22cf3c..00be830236a8435c28c6c251d686fe0aaed6786c 100644 (file)
--- a/tga.c
+++ b/tga.c
@@ -38,7 +38,7 @@ Some of these functions are internal.
 
 
 typedef struct {
 
 
 typedef struct {
-  char  idlength;
+  unsigned char  idlength;
   char  colourmaptype;
   char  datatypecode;
   short int colourmaporigin;
   char  colourmaptype;
   char  datatypecode;
   short int colourmaporigin;