[FFmpeg-devel] [PATCH] avcodec/decode: Improve validity check a bit

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Feb 29 11:36:27 EET 2024


Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/decode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index da6446d879..7c67b18bc4 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -977,8 +977,8 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>      }
>      if (!avctx->codec)
>          return AVERROR(EINVAL);
> -    if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) {
> -        av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n");
> +    if (ffcodec(avctx->codec)->cb_type != FF_CODEC_CB_TYPE_DECODE_SUB) {
> +        av_log(avctx, AV_LOG_ERROR, "Codec not subtitle decoder\n");
>          return AVERROR(EINVAL);
>      }
>  

Will apply this patch tomorrow unless there are objections.

- Andreas



More information about the ffmpeg-devel mailing list