Skip Menu |

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

Report information
The Basics
Id: 121073
Status: rejected
Priority: 0/
Queue: PDF-API2

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

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



Subject: Negative offset to vec in lvalue context
A bug in Perl 5.26 causes PDF::API2 to crash when loading PNG images. See https://rt.perl.org/Public/Bug/Display.html?id=131083 for details. The attached patch adds a workaround for this problem, in case it is not solved in time for the 5.26 release.
Subject: PDF_API2_Resource_XObject_Image_PNG.patch
*** PDF/API2/Resource/XObject/Image/PNG.pm~ 2017-04-11 18:03:15.841626104 +0200 --- PDF/API2/Resource/XObject/Image/PNG.pm 2017-04-11 18:00:44.084060531 +0200 *************** *** 264,269 **** --- 264,275 ---- } } + # Prevent "Negative offset to vec in lvalue context" for Perl 5.26. + sub __vec { + return 0 if $_[1] < 0; + vec( $_[0], $_[1], $_[2] ); + } + sub unprocess { my ($bpc,$bpp,$comp,$width,$height,$scanline,$sstream)=@_; my $stream=uncompress($$sstream); *************** *** 280,286 **** $clear=$line; } elsif($filter==1) { foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+vec($clear,$x-$bpp,8))%256; } } elsif($filter==2) { foreach my $x (0..length($line)-1) { --- 286,292 ---- $clear=$line; } elsif($filter==1) { foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+__vec($clear,$x-$bpp,8))%256; } } elsif($filter==2) { foreach my $x (0..length($line)-1) { *************** *** 288,299 **** } } elsif($filter==3) { foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+floor((vec($clear,$x-$bpp,8)+vec($prev,$x,8))/2))%256; } } elsif($filter==4) { # die "paeth/png filter not supported."; foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+PaethPredictor(vec($clear,$x-$bpp,8),vec($prev,$x,8),vec($prev,$x-$bpp,8)))%256; } } $prev=$clear; --- 294,305 ---- } } elsif($filter==3) { foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+floor((__vec($clear,$x-$bpp,8)+vec($prev,$x,8))/2))%256; } } elsif($filter==4) { # die "paeth/png filter not supported."; foreach my $x (0..length($line)-1) { ! vec($clear,$x,8)=(vec($line,$x,8)+PaethPredictor(__vec($clear,$x-$bpp,8),vec($prev,$x,8),__vec($prev,$x-$bpp,8)))%256; } } $prev=$clear;
Any idea if this is still a problem in 5.26.0? If so, can you provide a test case, please?
Subject: Re: [rt.cpan.org #121073] Negative offset to vec in lvalue context
Date: Sun, 2 Jul 2017 22:52:56 +0200
To: bug-PDF-API2 [...] rt.cpan.org
From: Johan Vromans <jvromans [...] squirrel.nl>
My test case that failed with 5.25.11 succeeds with 5.26.0 so it seems to have been fixed. See e.g. http://www.cpantesters.org/cpan/report/918a9c3c-5dc9-11e7-9e84-7306bfe21e72
Ok, good -- I wasn't eager to have to work around bugs in Perl itself. :-)