Commit 0f3cffa6 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

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
parent 4f8a30b1
......@@ -148,7 +148,9 @@ static vpx_codec_err_t vp9_peek_si(const uint8_t *data, unsigned int data_sz,
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment