History

avcodec/evc_ps: Check num_ref_pic_list_in_sps

Fixes: out of array write Fixes: 60798/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-4633529766772736

Michael Niedermayer committed 3 years ago

Commit cf9cd351 parent f9833032 files · +10 −1Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/evc.h +1 −1
  2. libavcodec/evc_ps.c +9 −0
libavcodec/evc.h+1−1
@@ -126,7 +126,7 @@ enum { · 125 unmodified lines
126 126
127 EVC_MAX_NUM_REF_PICS = 21,127 EVC_MAX_NUM_REF_PICS = 21,
128 128
129 EVC_MAX_NUM_RPLS = 32,129 EVC_MAX_NUM_RPLS = 64,
130 130
131 // A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are131 // A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are
132 // constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/132 // constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/
libavcodec/evc_ps.c+9−0
@@ -243,11 +243,20 @@ int ff_evc_parse_sps(GetBitContext *gb, EVCParamSets *ps) · 242 unmodified lines
243 sps->rpl1_same_as_rpl0_flag = get_bits1(gb);243 sps->rpl1_same_as_rpl0_flag = get_bits1(gb);
244 sps->num_ref_pic_list_in_sps[0] = get_ue_golomb(gb);244 sps->num_ref_pic_list_in_sps[0] = get_ue_golomb(gb);
245 245
246 if ((unsigned)sps->num_ref_pic_list_in_sps[0] >= EVC_MAX_NUM_RPLS) {
247 ret = AVERROR_INVALIDDATA;
248 goto fail;
249 }
250
246 for (int i = 0; i < sps->num_ref_pic_list_in_sps[0]; ++i)251 for (int i = 0; i < sps->num_ref_pic_list_in_sps[0]; ++i)
247 ref_pic_list_struct(gb, &sps->rpls[0][i]);252 ref_pic_list_struct(gb, &sps->rpls[0][i]);
248 253
249 if (!sps->rpl1_same_as_rpl0_flag) {254 if (!sps->rpl1_same_as_rpl0_flag) {
250 sps->num_ref_pic_list_in_sps[1] = get_ue_golomb(gb);255 sps->num_ref_pic_list_in_sps[1] = get_ue_golomb(gb);
256 if ((unsigned)sps->num_ref_pic_list_in_sps[1] >= EVC_MAX_NUM_RPLS) {
257 ret = AVERROR_INVALIDDATA;
258 goto fail;
259 }
251 for (int i = 0; i < sps->num_ref_pic_list_in_sps[1]; ++i)260 for (int i = 0; i < sps->num_ref_pic_list_in_sps[1]; ++i)
252 ref_pic_list_struct(gb, &sps->rpls[1][i]);261 ref_pic_list_struct(gb, &sps->rpls[1][i]);
253 }262 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t