diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-06 04:11:56 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-12 18:03:50 +0100 |
commit | 20d95a8ad32bac435e894c036c587c259f52512c (patch) | |
tree | a7dab7d7e864568bccca8684627c3b8903aa8db9 /libavcodec | |
parent | 3b90117a1f9a29dfe9588ad5de8c3f4b9640cc38 (diff) | |
download | ffmpeg-20d95a8ad32bac435e894c036c587c259f52512c.tar.gz |
avcodec/h264_ps: More completely check the bit depths
Fixes out of array read
Fixes: asan_static-oob_30328b6_719_cov_3325483287_H264_artifacts_motion.h264
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 69aa79365c1e8e1cb597d33e77bf1062c2ef47d4)
Conflicts:
libavcodec/h264_ps.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264_ps.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 4d4ff22bc1..52a4c902bf 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -365,7 +365,9 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ } sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8; sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8; - if (sps->bit_depth_luma > 12U || sps->bit_depth_chroma > 12U) { + if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 12 || + sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 12 || + sps->bit_depth_luma != sps->bit_depth_chroma) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", sps->bit_depth_luma, sps->bit_depth_chroma); goto fail; |