Hi Jason,
I had another Perl dev tell me similarly that since this was 10 years old
that I shouldn't bother filing. No matter, I figured I'd at least try to
help where possible. My Perl skills are dire, I have the ability to work
with Perl itself to a limited degree but not the code behind an XS, sorry.
I only dug this deep because I found it interesting that a jpeg could lock
up something up and wondered what the cause could be. I think the
libjpeg-turbo maintainer may be on to something regarding the stdio source
manager -
https://github.com/libjpeg-turbo/libjpeg-turbo/issues/130#issuecomment-267654123
- it _may_ be that easy, I couldn't say.
Thanks for acknowledging the bug. I have a workaround for now (I add an
additional NUL to the end of my input if the input's a power-of-two length,
hacky, but it works), and this is the first file we've had this happen with
in hundreds of millions processed (almost 9 years of files). The speed at
which this is goes through triage to find a true solution doesn't affect me
too much. I felt I'd be letting people down if I didn't file this (I'd
already debugged it to ensure it wasn't our code at fault, and to find the
workaround).
First bug in 6 years, glad to be of service :D
Kind regards,
Michael.
On 13 January 2017 at 20:54, Jason Hudgins via RT <
bug-Image-TestJPG@rt.cpan.org> wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=119847 >
>
> Hi, I appreciate your efforts to debug this. Unfortunately this module is
> well over 10 years old, and I pretty much forgot how to code in Perl since
> I wrote it. Also I really do not have time to triage it at the moment. If
> it’s worth your time and you can discover the root cause (if it turns out
> to be in the module) I will patch it up and deploy a new version. The code
> in question was nearly entirely lifted out of libjpg and this is the first
> I’ve heard of this issue before. As a matter of fact, this is the first
> bug report I’ve had in about 6-7 years as well.
>
> Thanks,
> Jason
>
>
> > On Jan 13, 2017, at 10:16 AM, Michael Hart via RT <
> bug-Image-TestJPG@rt.cpan.org> wrote:
> >
> > Fri Jan 13 11:16:17 2017: Request 119847 was acted upon.
> > Transaction: Ticket created by michael.hart@zoopla.co.uk
> > Queue: Image-TestJPG
> > Subject: Fwd: Infinite loop on power-of-two length broken jpeg
> > Broken in: (no value)
> > Severity: (no value)
> > Owner: Nobody
> > Requestors: michael.hart@zoopla.co.uk
> > Status: new
> > Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=119847 >
> >
> >
> > Hi there,
> >
> > Image-TestJPG-1.0
> >
> > I raised a bug against libjpeg-turbo because I initially thought the
> > problem was there
> >
https://github.com/libjpeg-turbo/libjpeg-turbo/issues/130
> > but they suggested it more likely with Image::TestJPG and would prefer
> > testing at your end (and possibly modifying your code) before considering
> > it likely a bug at theirs.
> >
> > I'm running Perl 5.16.3 on an EC2 AWS instance running 2016.09 AMI Linux
> >
> > The simplest code I have to cause this to occur is:
> >
> > use Image::TestJPG;
> > open my $fh, '<', "17093_5070_IMG_7.jpg";
> > $/ = undef;
> > my $file_data = <$fh>;
> > close $fh;
> > Image::TestJPG::testJPG($file_data, length($file_data));
> >
> > Which causes the process to hit 100% CPU and run for as long as you'll
> let
> > it, it looks to be a busy loop somewhere. This only occurs if the file
> is a
> > power of two length. Adding a NUL (or whatever other byte) to the end
> means
> > this no longer occurs, likewise stripping a byte.
> >
> > The file we've had this occur on is attached but it appears you can cause
> > it to occur with other power-of-two length files as well.
> >
> > Kind regards
> > Michael.
> >
> > <42cba16c-c2cf-11e6-8a7f-89b3957992ae.jpg>
>