Skip Menu |

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

Report information
The Basics
Id: 120346
Status: patched
Priority: 0/
Queue: PDF-Reuse

People
Owner: cnighs [...] cpan.org
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc:
AdminCc:

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



Subject: Parsing of refs is too strict
Just FYI, the PDF specification allows any amount of whitespace between the tokens in ‘Root 1 0 R’ etc. I see code like this in your module: m'\/Root\s+(\d+)\s{1,2}\d+\s{1,2}R'so which only allows up to two whitespace characters. (Also, \0 is considered whitespace in PDF syntax, but PDF::Reuse won’t recognise it as such.)
On Fri Feb 24 00:31:14 2017, SPROUT wrote: Show quoted text
> Just FYI, the PDF specification allows any amount of whitespace > between the tokens in ‘Root 1 0 R’ etc. I see code like this in your > module: > > m'\/Root\s+(\d+)\s{1,2}\d+\s{1,2}R'so > > which only allows up to two whitespace characters. (Also, \0 is > considered whitespace in PDF syntax, but PDF::Reuse won’t recognise it > as such.)
Also, comments are allowed between the tokens. This is valid: 1 % eieio 0 R
Thanks for taking time to open a bug! Any suggestions on a modified regexp that will work better? Chris
On Mon Feb 27 09:08:48 2017, CNIGHS wrote: Show quoted text
> Thanks for taking time to open a bug! > > Any suggestions on a modified regexp that will work better?
This will match a single whitespace character or comment: $ws = '(?:[ \0\n\r\t\f]|%[^\r\n]*[\r\n])'; Then /...$ws*.../ will match optional whitespace, and /...$ws+.../ will match mandatory whitespace.
On Mon Feb 27 22:57:26 2017, SPROUT wrote: Show quoted text
> On Mon Feb 27 09:08:48 2017, CNIGHS wrote:
> > Thanks for taking time to open a bug! > > > > Any suggestions on a modified regexp that will work better?
> > This will match a single whitespace character or comment: > > $ws = '(?:[ \0\n\r\t\f]|%[^\r\n]*[\r\n])'; > > Then /...$ws*.../ will match optional whitespace, and /...$ws+.../ > will match mandatory whitespace.
I've pushed your patch to the 0.40 branch. Please test and see if this addresses the issue. https://github.com/cnighswonger/PDF-Reuse/tree/ver_0.40 Thanks! Chris