op_parameters: Use unsigned_literal for read/write
decoder_buffer_delay and encoder_buffer_delay are read / written using
'encoder_decoder_buffer_delay_length' bits.
And 'encoder_decoder_buffer_delay_length' is read from bitstream as a
5-bit value + 1. So, it has a range of 1 to 32.
So, as the max number of bits for reading/writing decoder_buffer_delay
and encoder_buffer_delay are 32, we should be using
aom_rb_read_unsigned_literal() ind aom_wb_write_unsigned_literal()
functions, which support max 'bits' value of 32.
BUG=oss-fuzz:9126
Change-Id: I3896259f79613f5b82bda431756086dc9fea773e
diff --git a/aom_dsp/bitreader_buffer.c b/aom_dsp/bitreader_buffer.c
index 68fc381..0f5c598 100644
--- a/aom_dsp/bitreader_buffer.c
+++ b/aom_dsp/bitreader_buffer.c
@@ -8,6 +8,9 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
+
+#include <assert.h>
+
#include "config/aom_config.h"
#include "aom_dsp/bitreader_buffer.h"
@@ -31,6 +34,7 @@
}
int aom_rb_read_literal(struct aom_read_bit_buffer *rb, int bits) {
+ assert(bits <= 31);
int value = 0, bit;
for (bit = bits - 1; bit >= 0; bit--) value |= aom_rb_read_bit(rb) << bit;
return value;
@@ -38,6 +42,7 @@
uint32_t aom_rb_read_unsigned_literal(struct aom_read_bit_buffer *rb,
int bits) {
+ assert(bits <= 32);
uint32_t value = 0;
int bit;
for (bit = bits - 1; bit >= 0; bit--)