Skip Menu |

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

Report information
The Basics
Id: 97560
Status: new
Priority: 0/
Queue: CAM-PDF

People
Owner: Nobody in particular
Requestors: melmothx [...] gmail.com
Cc:
AdminCc:

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



Subject: Fail with decoded paths
Date: Mon, 28 Jul 2014 16:14:21 +0200
To: bug-CAM-PDF [...] rt.cpan.org
From: Marco Pessotto <melmothx [...] gmail.com>
Hello there and thanks for CAM::PDF. It looks like passing a decoded string to the CAM::PDF constructor, the module can't handle the stream, because the decoding is inherited into the stream. I hit this bug on perl 5.20, but not in perl 5.14. For what is worth, the test.pdf is a PDF version 1.5, attached. Best wishes #!/usr/bin/env perl use utf8; use strict; use warnings; use Test::More tests => 7; use File::Spec; use CAM::PDF; use Encode qw/encode_utf8 decode_utf8 is_utf8/; my $enc_filename = File::Spec->rel2abs("test.pdf"); my $dec_filename = decode_utf8(File::Spec->rel2abs("test.pdf")); ok(is_utf8($dec_filename), "dec is decoded"); ok(!is_utf8($enc_filename), "enc is encoded"); is ($enc_filename, $dec_filename, "repo paths match"); ok(-e $enc_filename); ok(-e $dec_filename); ok (CAM::PDF->new($enc_filename), "encoded path works") or diag $CAM::PDF::errstr; ok (CAM::PDF->new($dec_filename), "decoded path fails") or diag $CAM::PDF::errstr; __END__ 1..7 ok 1 - dec is decoded ok 2 - enc is encoded ok 3 - repo paths match ok 4 ok 5 ok 6 - encoded path works not ok 7 - decoded path fails # Failed test 'decoded path fails' # at cam-pdf.pl line 27. # Invalid xref stream: could not decode the stream # Looks like you failed 1 test of 7.
Download test.pdf
application/pdf 34.1k

Message body not shown because it is not plain text.

-- Marco
Subject: Re: [rt.cpan.org #97560] AutoReply: Fail with decoded paths
Date: Mon, 28 Jul 2014 19:16:27 +0200
To: bug-CAM-PDF [...] rt.cpan.org
From: Marco Pessotto <melmothx [...] gmail.com>
The following patch works for me (thanks to ribasushi to point out the problem). Best wishes --- PDF.pm~ 2014-07-28 19:12:10.340394556 +0200 +++ PDF.pm 2014-07-28 19:13:28.436396955 +0200 @@ -311,9 +311,10 @@ if (1024 > length $content) { my $file = $content; + $content = q{}; + if ($file eq q{-}) { - $content = q{}; my $offset = 0; my $step = 4096; binmode STDIN; ##no critic (Syscalls) -- Marco