[FFmpeg-devel] [PATCH] h264_ps: validate chroma sample location

Kieran Kunhya kierank at obe.tv
Fri Jan 6 23:47:25 EET 2017


On Fri, 6 Jan 2017 at 20:44 Andreas Cadhalpun <
andreas.cadhalpun at googlemail.com> wrote:

> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavcodec/h264_ps.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> index 8218e3a010..089bfc650a 100644
> --- a/libavcodec/h264_ps.c
> +++ b/libavcodec/h264_ps.c
> @@ -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_WARNING, "Invalid chroma sample location
> %d, setting to unspecified\n", avctx->chroma_sample_location);
> +            avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
> +        }
>
>
Is there a way to long only once, this seems like it could spam the user
full of these warnings.

Kieran
-- 

Sent from my mobile device


More information about the ffmpeg-devel mailing list