mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
avcodec/hevc/sei: prevent storing a potentially bogus num_ref_displays value in HEVCSEITDRDI
Fixes: 439711052/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4956250308935680
Fixes: out of array access
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d448d6d1a0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
638cafa70b
commit
a6ac0c6841
@@ -152,6 +152,8 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb)
|
||||
|
||||
static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitContext *gb)
|
||||
{
|
||||
unsigned num_ref_displays;
|
||||
|
||||
s->prec_ref_display_width = get_ue_golomb(gb);
|
||||
if (s->prec_ref_display_width > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -161,10 +163,10 @@ static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitCont
|
||||
if (s->prec_ref_viewing_dist > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->num_ref_displays = get_ue_golomb(gb);
|
||||
if (s->num_ref_displays > 31)
|
||||
num_ref_displays = get_ue_golomb(gb);
|
||||
if (num_ref_displays > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->num_ref_displays += 1;
|
||||
s->num_ref_displays = num_ref_displays + 1;
|
||||
|
||||
for (int i = 0; i < s->num_ref_displays; i++) {
|
||||
int length;
|
||||
|
||||
Reference in New Issue
Block a user