Tue Sep 27 06:01:15 2016 gortan [...] cpan.org - Ticket created
Subject: importpage results in endless recursion (cross-reference-related?)
The attached single-page PDF (which seems to be correct, as far as I can tell) results in an endless recursion when calling import_page with PDF::API2 version 2.028. With version 2.025 I get the message that cross-reference files are not supported, so the issue might be cross-reference-related. I attached a minimal script to reproduce the issue (it's basically just calling import_page).
The stack trace might show the cause of the issue:
...
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, 0)
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, 0)
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, undef)
PDF::API2::Basic::PDF::File::read_obj(ref(PDF::API2::Basic::PDF::File), ref(PDF::API2::Basic::PDF::Array))
PDF::API2::Basic::PDF::Objind::realise(ref(PDF::API2::Basic::PDF::Array))
PDF::API2::importPageIntoForm(ref(PDF::API2), ref(PDF::API2), ref(PDF::API2::Page))
PDF::API2::import_page(ref(PDF::API2), ref(PDF::API2), 1)
Note that read_obj calls read_objnum with an undefined $num, which results in the endless recursion. I guess at least read_objnum should return if called this way, so the endless recursion would not occur. Whether further things need to be fixed is beyond my insight...
Thanks for checking..!
test.pl:
#! /usr/bin/env perl
use PDF::API2;
use strict;
use warnings;
my $filename = shift or die "Usage: $0 <file.pdf>\n";
my $pdf = PDF::API2->open($filename);
my $out = PDF::API2->new();
my $out_page = $out->import_page( $pdf, 1 );
<< file too large to attach. access via
https://rt.cpan.org/Ticket/Attachment/1672574/897624/iPad_PDF_10.pdf >>
#
Thu Oct 06 23:23:34 2016 steve [...] deefs.net - Correspondence added
This is due to the same bug as RT #113293, which was just patched. The fix will be in the next release (2.029).
#
Thu Oct 06 23:23:35 2016 The RT System itself - Status changed from 'new' to 'open'
#
Thu Oct 06 23:23:45 2016 steve [...] deefs.net - Status changed from 'open' to 'patched'
#
Fri Oct 07 04:27:34 2016 gortan [...] cpan.org - Correspondence added
Yep, I can confirm that this bugfix solves my problem - now that is a nasty language "feature"! Thanks a lot!
#
Mon Oct 10 09:23:11 2016 steve [...] deefs.net - Status changed from 'patched' to 'resolved'
#
Mon Oct 10 09:23:12 2016 steve [...] deefs.net - Broken in 2.026 added
#
Mon Oct 10 09:23:12 2016 steve [...] deefs.net - Broken in 2.028 deleted
#
Mon Oct 10 09:23:12 2016 steve [...] deefs.net - Fixed in 2.029 added