From 5874739904fa8f13be03faee27e4bb2ac061258f Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Date: Fri, 6 Jan 2017 21:36:39 +0100
Subject: [PATCH] h264_ps: validate chroma sample location
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
libavcodec/h264_ps.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -181,6 +181,10 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
if (get_bits1(gb)) {
/* chroma_sample_location_type_top_field */
avctx->chroma_sample_location = get_ue_golomb(gb) + 1;
+ if (!av_chroma_location_name(avctx->chroma_sample_location)) {
+ av_log(avctx, AV_LOG_VERBOSE, "Invalid chroma sample location %d, setting to unspecified\n", avctx->chroma_sample_location);
+ avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
+ }
get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */
}
--
2.11.0