GNOME Bugzilla – Bug 687643
jpegenc: crashes if input buffer is too small, instead of erroring out gracefully
Last modified: 2012-11-05 16:41:44 UTC
Created attachment 228109 [details] Jpeg that produces the issue. I've created a .yuv dump of a jpeg using this pipeline: gst-launch filesrc location=Foot\ Tat\ Han\ Solo.jpg ! jpegdec ! colorspace ! video/x-raw-yuv,format='(fourcc)'UYVY,width=768,height=1024,framerate='(fraction)'0/1 ! filesink location=sample.yuv Then, tried to re-encode it with this pipeline: gst-launch filesrc location=sample.yuv ! video/x-raw-yuv,format='(fourcc)'UYVY,width=768,height=1024,framerate='(fraction)'0/1 ! jpegenc ! filesink location=sample.jpeg When i try this, jpegenc crashes (SIGSEGV). The backtrace from GDB is as follows:
+ Trace 231134
I'm using the debian testing (wheezy) packages. Thanks for looking into this; i've attached a jpeg that produces this issue, but i've been able to produce it with several different jpegs (from different sources/encoders)
> Then, tried to re-encode it with this pipeline: > > gst-launch filesrc location=sample.yuv ! > video/x-raw-yuv,format='(fourcc)'UYVY,width=768,height=1024,framerate='(fraction)'0/1 > ! jpegenc ! filesink location=sample.jpeg > > When i try this, jpegenc crashes (SIGSEGV). This is probably INVALID. Try adding blocksize=9999999 to filesrc, or using the videoparse element between filesrc and jpegenc. The problem is that by default filesrc reads data in 4096 byte chunks, but jpegenc expects the data to be as large as the video size requires it to be. (Arguably, it should check for that too).
That is exactly right. I tried that flag, and it worked without a hitch! Jpegenc should check for that, and throw an error (or otherwise recover) instead of crashing. This fixes it for me (for now) thanks!
commit c237f04233bc53022df17909cb185e3ea0c67c37 Author: Tim-Philipp Müller <tim@centricular.net> Date: Mon Nov 5 16:31:16 2012 +0000 jpegenc: error out gracefully if input buffer is too small https://bugzilla.gnome.org/show_bug.cgi?id=687643