After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761670 - jpegdec: Possible endless loop if file is corrupt
jpegdec: Possible endless loop if file is corrupt
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.6.3
Other Linux
: Normal major
: 1.6.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
1.6.4
Depends on:
Blocks:
 
 
Reported: 2016-02-07 15:06 UTC by Felix Riemann
Modified: 2016-04-14 17:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the jpeg file triggering this (90 bytes, image/jpeg)
2016-02-07 15:06 UTC, Felix Riemann
  Details
jpegdec: Don't pass the same data over and over (1.89 KB, patch)
2016-02-07 20:09 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Felix Riemann 2016-02-07 15:06:14 UTC
Created attachment 320572 [details]
the jpeg file triggering this

Today I noticed tracker-extract using 100% for hours on a JPG file I had on my disk.

The (attached) file is actually a corrupt file I received some time ago from a bug report in eog. It's part of a suite of image files that were created using some new data fuzzing tool: http://lcamtuf.coredump.cx/afl/demo/

When tracker-extract started working on it, it's JPEG extraction module failed, however it then falls back to its GStreamer module where it starts using 100% CPU. Turns out it's easy to reproduce with GStreamer alone: gst-launch-1.0 filesrc location=<filename> ! jpegdec ! autovideosink

Debugging it, it looks like gst_jpeg_dec_fill_input_buffer is passing the file data over and over again into the decoder instead of reporting EOF/EOS. The decoder isn't noticing the problem as it is waiting for a SOF or a EOI JPEG marker (both are missing in the file) and thus is looping endlessly over the same image data.
Comment 1 Nicolas Dufresne (ndufresne) 2016-02-07 20:08:48 UTC
I confirm the bug. As this element does not stream the jpeg to the decoder (it sends complete frames), it make no sense to do anything in _fill callback. I'm not saying it shouldn't stream (this would use slightly less memory, and could reduce the latency), but it's the state of it.
Comment 2 Nicolas Dufresne (ndufresne) 2016-02-07 20:09:10 UTC
Created attachment 320584 [details] [review]
jpegdec: Don't pass the same data over and over

We already pass the entire frame to the decoder. If the decoder ask for
more data, don't pass the same data again as this leads to infinit loop.
Instead, simply fail the fill function to signal the problem with that
frame. It will then be skipped properly.
Comment 3 Nicolas Dufresne (ndufresne) 2016-02-08 15:21:18 UTC
Attachment 320584 [details] pushed as 905e28a - jpegdec: Don't pass the same data over and over
Comment 4 Nicolas Dufresne (ndufresne) 2016-02-08 15:21:50 UTC
This is probably a candidate for backport.