diff mbox series

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

Message ID AS8P250MB0744642AD5EA502469E208608F592@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 80736531da54213a515ff24ca3e929afe214ed0f
Headers show
Series [FFmpeg-devel] avcodec/decode: Improve validity check a bit | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 27, 2024, 9:13 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/decode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Feb. 29, 2024, 9:36 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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
diff mbox series

Patch

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);
     }