aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsha Shrikant Kulkarni <isha.kulkarni@ittiam.com>2019-01-11 12:09:22 +0530
committerRay Essick <essick@google.com>2019-03-28 14:40:27 -0700
commit96f7193ba02493e7bb944a3195e25b1301af6416 (patch)
treef312583e7a02f5524ae4d74f7ccdb0d2ab6e9fc2
parentfc7139a53e12b41a622af98eb6c7ba2f42508009 (diff)
downloadlibavc-96f7193ba02493e7bb944a3195e25b1301af6416.tar.gz
Decoder: Fix integer sanitizer issues in ih264d_parse_cabac
Bug: 118445723 Test: vendor Change-Id: Icf98785fa474bd9c774ba4282b9c3d73360a69ea
-rw-r--r--decoder/ih264d_defs.h2
-rw-r--r--decoder/ih264d_parse_cabac.c18
2 files changed, 10 insertions, 10 deletions
diff --git a/decoder/ih264d_defs.h b/decoder/ih264d_defs.h
index 260e358..61743be 100644
--- a/decoder/ih264d_defs.h
+++ b/decoder/ih264d_defs.h
@@ -600,7 +600,7 @@ enum
#endif //DEBLOCK_THREAD
#define NUM_COEFFS_IN_4x4BLK 16
-
+#define CABAC_BITS_TO_READ 23
#define MEMSET_16BYTES(pu4_start,value) \
{ \
diff --git a/decoder/ih264d_parse_cabac.c b/decoder/ih264d_parse_cabac.c
index 9d58f33..c4a3bd5 100644
--- a/decoder/ih264d_parse_cabac.c
+++ b/decoder/ih264d_parse_cabac.c
@@ -400,7 +400,7 @@ UWORD8 ih264d_read_coeff4x4_cabac(dec_bit_stream_t *ps_bitstrm,
{
UWORD32 uc_bin;
UWORD32 bits_to_flush;
- UWORD32 max_bits = 32;
+
bits_to_flush = 0;
/*renormalize to ensure there 23 bits more in the u4_code_int_val_ofst*/
@@ -409,7 +409,7 @@ UWORD8 ih264d_read_coeff4x4_cabac(dec_bit_stream_t *ps_bitstrm,
u4_clz = CLZ(u4_code_int_range);
FLUSHBITS(u4_offset, u4_clz)
- NEXTBITS(read_bits, u4_offset, pu4_buffer, 23)
+ NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
u4_code_int_range = u4_code_int_range << u4_clz;
u4_code_int_val_ofst = (u4_code_int_val_ofst
<< u4_clz) | read_bits;
@@ -438,7 +438,7 @@ UWORD8 ih264d_read_coeff4x4_cabac(dec_bit_stream_t *ps_bitstrm,
ps_cab_env);INC_BYPASS_BINS(ps_cab_env);
}
- while(uc_bin && (bits_to_flush < max_bits));
+ while(uc_bin && (bits_to_flush < CABAC_BITS_TO_READ));
u4_value = (bits_to_flush - 1);
@@ -459,7 +459,7 @@ UWORD8 ih264d_read_coeff4x4_cabac(dec_bit_stream_t *ps_bitstrm,
u4_clz = CLZ(u4_code_int_range);
FLUSHBITS(u4_offset, u4_clz)
- NEXTBITS(read_bits, u4_offset, pu4_buffer, 23)
+ NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
u4_code_int_range = u4_code_int_range << u4_clz;
u4_code_int_val_ofst = (u4_code_int_val_ofst
<< u4_clz) | read_bits;
@@ -868,7 +868,7 @@ void ih264d_read_coeff8x8_cabac(dec_bit_stream_t *ps_bitstrm,
{
UWORD32 uc_bin;
UWORD32 bits_to_flush;
- UWORD32 max_bits = 32;
+
bits_to_flush = 0;
/*renormalize to ensure there 23 bits more in the u4_code_int_val_ofst*/
@@ -877,7 +877,7 @@ void ih264d_read_coeff8x8_cabac(dec_bit_stream_t *ps_bitstrm,
u4_clz = CLZ(u4_code_int_range);
FLUSHBITS(u4_offset, u4_clz)
- NEXTBITS(read_bits, u4_offset, pu4_buffer, 23)
+ NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
u4_code_int_range = u4_code_int_range << u4_clz;
u4_code_int_val_ofst = (u4_code_int_val_ofst
<< u4_clz) | read_bits;
@@ -902,7 +902,7 @@ void ih264d_read_coeff8x8_cabac(dec_bit_stream_t *ps_bitstrm,
}
}
- while(uc_bin && (bits_to_flush < max_bits));
+ while(uc_bin && (bits_to_flush < CABAC_BITS_TO_READ));
u4_value = (bits_to_flush - 1);
}
@@ -921,7 +921,7 @@ void ih264d_read_coeff8x8_cabac(dec_bit_stream_t *ps_bitstrm,
u4_clz = CLZ(u4_code_int_range);
FLUSHBITS(u4_offset, u4_clz)
- NEXTBITS(read_bits, u4_offset, pu4_buffer, 23)
+ NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
u4_code_int_range = u4_code_int_range << u4_clz;
u4_code_int_val_ofst = (u4_code_int_val_ofst
<< u4_clz) | read_bits;
@@ -967,7 +967,7 @@ void ih264d_read_coeff8x8_cabac(dec_bit_stream_t *ps_bitstrm,
//Value of K
ui16_sufS += u4_value;
- i2_abs_lvl += ui16_sufS;
+ i2_abs_lvl += (WORD32)ui16_sufS;
}
else
{