diff mbox series

[FFmpeg-devel,v3,3/3] avcodec/libx264: return error if unknown picture type encountered

Message ID 20200418045249.8057-3-lance.lmwang@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v3,1/3] avcodec/libx265: Fix Uninitialized scalar variable | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang April 18, 2020, 4:52 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libx264.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Anton Khirnov May 10, 2020, 5:43 p.m. UTC | #1
Quoting lance.lmwang@gmail.com (2020-04-18 06:52:49)
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavcodec/libx264.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index edd343e..3fa2311 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -476,7 +476,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
>          pict_type = AV_PICTURE_TYPE_B;
>          break;
>      default:
> -        pict_type = AV_PICTURE_TYPE_NONE;
> +        av_log(ctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
> +        return AVERROR_EXTERNAL;

Why should that cause encoding to fail?
And when would this happen?
diff mbox series

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index edd343e..3fa2311 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -476,7 +476,8 @@  static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
         pict_type = AV_PICTURE_TYPE_B;
         break;
     default:
-        pict_type = AV_PICTURE_TYPE_NONE;
+        av_log(ctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+        return AVERROR_EXTERNAL;
     }
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS