Skip to content

Commit

Permalink
mvcdec: Integer overflow in imvcd_parse_subset_sps
Browse files Browse the repository at this point in the history
The cases where the value for log2MaxPocLsb was exceeding
'MAX_BITS_IN_POC_LSB' was not being handled correctly,
which was resulting in an integer overflow. This has been
fixed.

Test: mvc_dec_fuzzer
  • Loading branch information
AshwinNatesan-ittiam committed Oct 13, 2023
1 parent ea69487 commit 7b81de0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions decoder/mvc/imvcd_nalu_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,17 @@ static WORD32 imvcd_parse_subset_sps(mvc_dec_ctxt_t *ps_mvcd_ctxt, dec_bit_strea

if(ps_subset_sps->s_sps_data.u1_pic_order_cnt_type == 0)
{
ps_subset_sps->s_sps_data.u1_log2_max_pic_order_cnt_lsb_minus =
4 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
UWORD32 u1_log2_max_pic_order_cnt_lsb_minus4 =
ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);

if(ps_subset_sps->s_sps_data.u1_log2_max_pic_order_cnt_lsb_minus > MAX_BITS_IN_POC_LSB)
if(u1_log2_max_pic_order_cnt_lsb_minus4 > (MAX_BITS_IN_POC_LSB - 4))
{
return ERROR_INV_SPS_PPS_T;
}

ps_subset_sps->s_sps_data.u1_log2_max_pic_order_cnt_lsb_minus =
4 + u1_log2_max_pic_order_cnt_lsb_minus4;

ps_subset_sps->s_sps_data.i4_max_pic_order_cntLsb =
(1 << ps_subset_sps->s_sps_data.u1_log2_max_pic_order_cnt_lsb_minus);
}
Expand Down

0 comments on commit 7b81de0

Please sign in to comment.