diff mbox series

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

Message ID 20200117044848.2829-2-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v1] avcodec/libx265: Fix Uninitialized scalar variable
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork fail Make failed

Commit Message

Limin Wang Jan. 17, 2020, 4:48 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

Michael Niedermayer Jan. 17, 2020, 9:09 p.m. UTC | #1
On Fri, Jan 17, 2020 at 12:48:48PM +0800, lance.lmwang@gmail.com wrote:
> 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 ca8f6c0..4fef0be 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -471,7 +471,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(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
> +        return AVERROR_EXTERNAL;
>      }

its ctx not avctx, this wont build

[...]
Limin Wang Jan. 17, 2020, 10:32 p.m. UTC | #2
On Fri, Jan 17, 2020 at 10:09:47PM +0100, Michael Niedermayer wrote:
> On Fri, Jan 17, 2020 at 12:48:48PM +0800, lance.lmwang@gmail.com wrote:
> > 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 ca8f6c0..4fef0be 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -471,7 +471,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(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
> > +        return AVERROR_EXTERNAL;
> >      }
> 
> its ctx not avctx, this wont build
yes, it's my fault, I realized that my test branch did not compile the libx264 library.

> 
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> You can kill me, but you cannot change the truth.



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index ca8f6c0..4fef0be 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -471,7 +471,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(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+        return AVERROR_EXTERNAL;
     }
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS