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
This commit is contained in:
parent
4f8a30b116
commit
0f3cffa685
@ -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 };
|
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 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)
|
if (frame_marker != VP9_FRAME_MARKER)
|
||||||
return VPX_CODEC_UNSUP_BITSTREAM;
|
return VPX_CODEC_UNSUP_BITSTREAM;
|
||||||
#if CONFIG_NON420
|
#if CONFIG_NON420
|
||||||
|
Loading…
x
Reference in New Issue
Block a user