Skip Menu |
 

This queue is for tickets about the PDF-API2 CPAN distribution.

Report information
The Basics
Id: 33970
Status: resolved
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: RBS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.69
Fixed in: 2.029



Subject: Patch to report errors opening PNG image files
Download (untitled) / with headers
text/plain 1.2k
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
Download png.diff
text/x-diff 463b
--- 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'}='';
Subject: [rt.cpan.org #33970]
Date: Mon, 15 Feb 2016 16:50:41 -0500
To: bug-PDF-API2 [...] rt.cpan.org
From: Phil M Perry <philperry [...] hvc.rr.com>
Download (untitled) / with headers
text/plain 717b
I could get behind this request to not silently err on failure to open a file. The only question is whether a "die" is the best thing to do, or should some recovery attempt take place to limp along (give an error message in that case)? Adding an "or die" to all file operations (at least, opens and closes) shouldn't be rocket science, if there are any such cases still open. To add a comment to this thread, just email bug-PDF-API2 [at] rt.cpan.org with subject line [rt.cpan.org #33970]. Note 1 space between org and #, and the [ ] around the whole subject. Nothing else. If you don't follow this format carefully, you will end up creating a new bug report! HTML formatting within the body does not work.
Download (untitled) / with headers
text/plain 133b
I bet you wouldn't have guessed that it would take 8.5 years for this to get done! These checks will be in the next release (2.029).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.