Subject: | Patch to report errors opening PNG image files |
MIME-Version: | 1.0 |
X-Mailer: | MIME-tools 5.418 (Entity 5.418) |
Charset: | utf8 |
X-RT-Original-Encoding: | utf-8 |
Content-Type: | multipart/mixed; boundary="----------=_1205180802-28598-2" |
Content-Length: | 0 |
Content-Type: | text/plain |
Content-Disposition: | inline |
Content-Transfer-Encoding: | binary |
Content-Length: | 1289 |
PNG.pm does not die when an open() fails, resulting in mysterious
undefined value errors. The attached patch adds an "or die()" to the
open() and removes a possibly duplicate open.
Also, here is a series of other similar lines of code that don't happen
to be biting me (yet):
c:\perl\site\lib\PDF\API2\Resource\ColorSpace\Indexed\ACTFile.pm:
open($fh,$file);
c:\perl\site\lib\PDF\API2\Resource\Font\Postscript.pm :
open(INF,$file);
c:\perl\site\lib\PDF\API2\Resource\Font\Postscript.pm :
open($fh,$file) || return undef;
c:\perl\site\lib\PDF\API2\Resource\XObject\Image\GIF.pm :
open($fh,$file);
c:\perl\site\lib\PDF\API2\Resource\XObject\Image\JPEG.pm :
open($fh,$file);
c:\perl\site\lib\PDF\API2\Resource\XObject\Image\PNM.pm :
open(INF,$file);
c:\perl\site\lib\PDF\API2\Resource\XObject\Image\TIFF.pm :
open($self->{fh},"< $file");
c:\perl\site\lib\PDF\API2\Util.pm :
open($fh,"$dir/PDF/API2/Resource/unipaper.txt");
c:\perl\site\lib\PDF\API2\Util.pm :
open($fh,"$dir/PDF/API2/Resource/uniglyph.txt");
c:\perl\site\lib\PDF\API2\Util.pm :
open($fh,"$dir/PDF/API2/Resource/unicolor.txt");
Subject: | png.diff |
MIME-Version: | 1.0 |
Content-Type: | multipart/mixed; boundary="----------=_1205180802-28598-1" |
X-Mailer: | MIME-tools 5.418 (Entity 5.418) |
Charset: | utf8 |
Content-Length: | 0 |
Content-Type: | text/plain |
Content-Disposition: | inline |
Content-Transfer-Encoding: | binary |
X-RT-Original-Encoding: | iso-8859-1 |
Content-Length: | 0 |
Content-Type: | application/octet-stream; name="png.diff" |
Content-Disposition: | inline; filename="png.diff" |
Content-Transfer-Encoding: | base64 |
Content-Length: | 463 |
--- c:\Perl\site\lib\PDF\API2\Resource\XObject\Image\PNG.pm Mon Mar 10 16:22:54 2008
+++ PNG.pm Mon Mar 10 16:23:10 2008
@@ -65,11 +65,9 @@
$self->{' apipdf'}=$pdf;
my $fh = IO::File->new;
- open($fh,$file);
- binmode($fh,':raw');
my ($buf,$l,$crc,$w,$h,$bpc,$cs,$cm,$fm,$im,$palete,$trns);
- open($fh,$file);
+ open($fh,$file) or die "$!: $file\n";
binmode($fh);
seek($fh,8,0);
$self->{' stream'}='';