From: Gwenole Beauchesne Date: Wed, 18 Sep 2013 13:56:52 +0000 (+0200) Subject: codecparsers: jpeg: fix calculation of segment size. X-Git-Tag: 1.19.3~507^2~8459 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41ed5c0266489f7247a8f6a2fc13bb4e0c73c516;p=platform%2Fupstream%2Fgstreamer.git codecparsers: jpeg: fix calculation of segment size. The size of a marker segment is defined to be exclusive of any initial marker code. So, fix the size for SOI, EOI and APPn segments but also the size of any possible segment that is usually "reserved" or not explicitly defined. https://bugzilla.gnome.org/show_bug.cgi?id=707447 --- diff --git a/gst-libs/gst/codecparsers/gstjpegparser.c b/gst-libs/gst/codecparsers/gstjpegparser.c index 8ee2d44..ac1ba9a 100644 --- a/gst-libs/gst/codecparsers/gstjpegparser.c +++ b/gst-libs/gst/codecparsers/gstjpegparser.c @@ -222,7 +222,7 @@ jpeg_parse_to_next_marker (GstByteReader * br, guint8 * marker) if (marker) *marker = br->data[ofs + 1]; - gst_byte_reader_skip (br, ofs - br->byte + 2); + gst_byte_reader_skip_unchecked (br, ofs - br->byte); return TRUE; } @@ -558,6 +558,7 @@ gst_jpeg_parse (GstJpegMarkerSegment * seg, return FALSE; } + gst_byte_reader_skip_unchecked (&br, 2); seg->offset = offset + gst_byte_reader_get_pos (&br); seg->size = -1; @@ -566,7 +567,7 @@ gst_jpeg_parse (GstJpegMarkerSegment * seg, case GST_JPEG_MARKER_SOI: case GST_JPEG_MARKER_EOI: fixed_size_segment: - seg->size = 2; + seg->size = 0; break; case (GST_JPEG_MARKER_SOF_MIN + 0): /* Lf */