Skip Menu |
 

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

Report information
The Basics
Id: 123839
Status: new
Priority: 0/
Queue: Text-PDF

People
Owner: Nobody in particular
Requestors: TPLA [...] cpan.org
Cc:
AdminCc:

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



Subject: OBOE error in /Length dicts for streams ending on ^M (patch incl.)
Download (untitled) / with headers
text/plain 1.3k
When computing the value of the /Length dict for streams ending on a carriage return, the necessary adjustment is not always applied. This results in corrupt PDFs. Compare Text::PDF::Dict->outobjdeep() line 90 $self->{'Length'} = Text::PDF::Number->new(length($self->{' stream'}) + ($self->{' stream'} =~ m/$cr$/o ? 0 : 1)); with line 171 (and 205), where 1 is always added regardless: $len = $fh->tell - $loc + 1; I believe the above line should be aligned with the logic of line 90 to read: $len = $fh->tell - $loc + ($str =~ m/$cr$/o ? 0 : 1); This'll uncorrupt the PDfs in question. Best regards Thomas --- Dict.pm.orig 2016-08-24 23:18:16.000000000 +0200 +++ Dict.pm 2017-12-08 11:32:45.483949200 +0100 @@ -168,7 +168,7 @@ $fh->print($str); if (@filts > 0) { - $len = $fh->tell - $loc + 1; + $len = $fh->tell - $loc + ($str =~ m/$cr$/o ? 0 : 1); if ($self->{'Length'}{'val'} != $len) { $self->{'Length'}{'val'} = $len; @@ -202,7 +202,7 @@ $fh->print($str); } - $len = $fh->tell - $loc + 1; + $len = $fh->tell - $loc + ($str =~ m/$cr$/o ? 0 : 1); if ($self->{'Length'}{'val'} != $len) { $self->{'Length'}{'val'} = $len; @@ -325,4 +325,4 @@ $res; } -1; \ No newline at end of file +1;


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.