shithub: libvpx

Download patch

ref: 0f3cffa685364706161362e8893758fadf270f60
parent: 4f8a30b116890f36fb83cbbe20c095e9ebdafccf
author: Dmitry Kovalev <[email protected]>
date: Fri Feb 7 09:21:19 EST 2014

Fixing undefined behavior vp9_peek_si().

Bitwise OR operation doesn't guarantee any subexpression evaluation order.
Just reading one bit now and ignoring the next one. For reference look at
vp9_decode_frame() implementation.

Change-Id: I4971686929838ae5ded8f43a38a2934db5e1d462

--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -148,7 +148,9 @@
   {
     struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL };
     const int frame_marker = vp9_rb_read_literal(&rb, 2);
-    const int version = vp9_rb_read_bit(&rb) | (vp9_rb_read_bit(&rb) << 1);
+    const int version = vp9_rb_read_bit(&rb);
+    (void) vp9_rb_read_bit(&rb);  // unused version bit
+
     if (frame_marker != VP9_FRAME_MARKER)
       return VPX_CODEC_UNSUP_BITSTREAM;
 #if CONFIG_NON420