avcodec/hevc_ps: Check chroma_format_idc

Fixes out of array access
Fixes: 24d05e8b84676799c735c9e27d97895e/asan_heap-oob_1b70f6a_2955_7c3652a7f370f9f3ef40642bc2c99bb2.bit

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 93f30f825c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-11-05 14:52:33 +01:00
parent 169a02da1e
commit d332aa6ec6
1 changed files with 3 additions and 0 deletions

View File

@ -806,6 +806,9 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
sps->chroma_format_idc = get_ue_golomb_long(gb);
if (sps->chroma_format_idc > 3U) {
return AVERROR_INVALIDDATA;
}
if (sps->chroma_format_idc == 3)
sps->separate_colour_plane_flag = get_bits1(gb);