[libav-devel] [PATCH 2/2] h264_ps: check validity of parsed chroma location values

Vittorio Giovara vittorio.giovara at gmail.com
Mon Nov 4 13:10:50 CET 2013


---
 libavcodec/h264_ps.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 819b7ff..95e0b9a 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -181,6 +181,11 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
         chroma_sample_loc_type_top_field    = get_ue_golomb(&h->gb);
         chroma_sample_loc_type_bottom_field = get_ue_golomb(&h->gb);
 
+        if (chroma_sample_loc_type_top_field != chroma_sample_loc_type_bottom_field) {
+            av_log(h->avctx, AV_LOG_WARNING, "Different chroma location for top and bottom fields is not supported.");
+            if (h->avctx->err_recognition & AV_EF_EXPLODE)
+                return AVERROR_PATCHWELCOME;
+        }
         h->avctx->chroma_sample_location = chroma_sample_loc_type_top_field + 1;
     }
 
-- 
1.7.9.5



More information about the libav-devel mailing list