Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

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
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
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
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
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'}='';
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-10159-1240857949-463.33970-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 72
MIME-Version: 1.0
X-Spam-Status: No, score=-2.251 tagged_above=-99.9 required=10 tests=[AWL=0.350, BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.001] autolearn=ham
X-Spam-Flag: NO
X-RT-Interface: API
X-Cloudmark-Score: 0
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Reply-To: philperry [...] hvc.rr.com
Message-ID: <56C24831.5070401 [...] hvc.rr.com>
content-type: text/plain; charset="utf-8"; format="flowed"
X-RR-Connecting-Ip: 107.14.168.142:25
X-RT-Original-Encoding: utf-8
X-Spam-Score: -2.251
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 502B42403B4 for <cpan-bug+PDF-API2 [...] hipster.bestpractical.com>; Mon, 15 Feb 2016 16:50:31 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dburOOyAGHyj for <cpan-bug+PDF-API2 [...] hipster.bestpractical.com>; Mon, 15 Feb 2016 16:50:30 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id ECCDB240334 for <bug-PDF-API2 [...] rt.cpan.org>; Mon, 15 Feb 2016 16:50:29 -0500 (EST)
Received: (qmail 19572 invoked by alias); 15 Feb 2016 21:50:29 -0000
Received: from cdptpa-outbound-snat.email.rr.com (HELO cdptpa-oedge-vip.email.rr.com) (107.14.166.228) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 15 Feb 2016 13:50:27 -0800
Received: from [24.161.11.83] ([24.161.11.83:2927] helo=[24.161.11.83]) by cdptpa-oedge03 (envelope-from <philperry [...] hvc.rr.com>) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 17/A2-22180-F1842C65; Mon, 15 Feb 2016 21:50:23 +0000
Delivered-To: cpan-bug+PDF-API2 [...] hipster.bestpractical.com
Subject: [rt.cpan.org #33970]
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
Return-Path: <philperry [...] hvc.rr.com>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+PDF-API2 [...] hipster.bestpractical.com
X-RT-Mail-Extension: pdf-api2
Date: Mon, 15 Feb 2016 16:50:41 -0500
X-Spam-Level:
To: bug-PDF-API2 [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Phil M Perry <philperry [...] hvc.rr.com>
RT-Message-ID: <rt-4.0.18-10574-1455573031-142.33970-0-0 [...] rt.cpan.org>
Content-Length: 717
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.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-11363-1476049734-1109.33970-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 133
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.