diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-01-22 18:01:24 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-01-23 09:35:11 +0100 |
commit | 82200d75ae1542922ec7f52f6ab7ba7746eebe67 (patch) | |
tree | d7c23bca7342d3196ae7c1673332ed80a85d0cab /gst-libs | |
parent | 1bf59acad82831c446f32a03eb097bddf868e099 (diff) | |
download | gstreamer-plugins-bad-82200d75ae1542922ec7f52f6ab7ba7746eebe67.tar.gz |
codecparsers: vc1: fix bitplanes decoding.
Fix decoding of DIFF2 or NORM2 bitplanes with an odd number of macroblocks.
In particular, account for the first bit that was already parsed so that to
avoid a buffer overflow after all pairs are parsed.
This fixes SA00040.vc1 conformance test.
https://bugzilla.gnome.org/show_bug.cgi?id=692312
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/codecparsers/gstvc1parser.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gst-libs/gst/codecparsers/gstvc1parser.c b/gst-libs/gst/codecparsers/gstvc1parser.c index 6630af8b5..baa697505 100644 --- a/gst-libs/gst/codecparsers/gstvc1parser.c +++ b/gst-libs/gst/codecparsers/gstvc1parser.c @@ -435,7 +435,7 @@ bitplane_decoding (GstBitReader * br, guint8 * data, const guint height = seqhdr->mb_height; const guint stride = seqhdr->mb_stride; guint imode, invert, invert_mask; - guint x, y, v; + guint x, y, v, o; guint8 *pdata = data; *is_raw = FALSE; @@ -464,7 +464,8 @@ bitplane_decoding (GstBitReader * br, guint8 * data, GST_DEBUG ("Parsing IMODE_DIFF2 or IMODE_NORM2 biplane"); x = 0; - if ((height * width) & 1) { + o = (height * width) & 1; + if (o) { GET_BITS (br, 1, &v); if (pdata) { *pdata++ = (v ^ invert_mask) & 1; @@ -475,7 +476,7 @@ bitplane_decoding (GstBitReader * br, guint8 * data, } } - for (y = 0; y < height * width; y += 2) { + for (y = o; y < height * width; y += 2) { if (!decode_vlc (br, &v, vc1_norm2_vlc_table, G_N_ELEMENTS (vc1_norm2_vlc_table))) goto failed; |