diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-05 14:52:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-19 03:51:39 +0100 |
commit | 6a82ec8844a1b3f6d7b6cfe0fd1293340d19c786 (patch) | |
tree | a18e14408b6faf5b1eb0a527676f94dfafb5ba9a | |
parent | a420cb8e45f53de8ad16e3b29f3523ca6ca036b4 (diff) | |
download | ffmpeg-6a82ec8844a1b3f6d7b6cfe0fd1293340d19c786.tar.gz |
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 93f30f825c08477fe8f76be00539e96014cc83c8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/hevc_ps.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 33a504fc57..7857d0c915 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -762,6 +762,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); |