Skip Menu |

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

Report information
The Basics
Id: 86452
Status: resolved
Priority: 0/
Queue: Text-PDF

People
Owner: bhallissy [...] cpan.org
Requestors: dmearns-bugs [...] dmearns.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.29a
Fixed in: 0.30



Subject: Parse error reading array
There is a potential problem parsing the pages array. I am processing the output of ps2pdf, and it puts the closing bracket of the Kids array on a new line. If it happens that the read of 255 bytes includes all the page objects, but not the closing bracket then the program will die with a parse error. This happened to me when processing a 30 page PDF file, but not all 30 page files crash. The problem is that because there is no closing bracket, it calls readval to read the next value for the array. But the first thing in $str is the closing bracket which is not expected. There needs to be another call to update() inside the loop that collects the array members. --- File.pm.original 2006-03-17 04:39:17.000000000 -0500 +++ File.pm 2013-06-26 15:40:30.204896736 -0400 @@ -622,18 +622,19 @@ } elsif ($str =~ m/^\[/o) # array { $str =~ s/^\[//o; $str = update($fh, $str); $res = PDFArray(); while ($str !~ m/^\]/o) { ($value, $str) = $self->readval($str, %opts); $res->add_elements($value); + $str = update($fh, $str); } $str =~ s/^\]//o; } elsif ($str =~ m/^(true|false)$irreg_char/o) # boolean { $value = $1; $str =~ s/^(?:true|false)//o; $res = Text::PDF::Bool->from_pdf($value); } elsif ($str =~ m/^([+-.0-9]+)$irreg_char/o) # number {