diff mbox

[FFmpeg-devel,2/3] avformat/oggparsedaala: Do not leave an invalid value in gpshift

Message ID 20170401171836.32701-2-michael@niedermayer.cc
State Accepted
Commit 23ae3cc822915ede2bb4e85047ab46cc5bc71268
Headers show

Commit Message

Michael Niedermayer April 1, 2017, 5:18 p.m. UTC
Fixes: undefined behavior
Fixes: 702974

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/oggparsedaala.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Rostislav Pehlivanov April 1, 2017, 8:04 p.m. UTC | #1
On 1 April 2017 at 18:18, Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: undefined behavior
> Fixes: 702974
>
> Found-by: Thomas Guilbert <tguilbert@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/oggparsedaala.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
> index ce65b2bd7a..a373b41b4c 100644
> --- a/libavformat/oggparsedaala.c
> +++ b/libavformat/oggparsedaala.c
> @@ -126,6 +126,7 @@ static int daala_header(AVFormatContext *s, int idx)
>          if (hdr->gpshift >= 32) {
>              av_log(s, AV_LOG_ERROR, "Too large gpshift %d (>= 32).\n",
>                     hdr->gpshift);
> +            hdr->gpshift = 0;
>              return AVERROR_INVALIDDATA;
>          }
>          hdr->gpmask  = (1U << hdr->gpshift) - 1;
> --
> 2.11.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

LGTM, thanks
Michael Niedermayer April 1, 2017, 8:09 p.m. UTC | #2
On Sat, Apr 01, 2017 at 09:04:48PM +0100, Rostislav Pehlivanov wrote:
> On 1 April 2017 at 18:18, Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Fixes: undefined behavior
> > Fixes: 702974
> >
> > Found-by: Thomas Guilbert <tguilbert@google.com>
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/oggparsedaala.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
> > index ce65b2bd7a..a373b41b4c 100644
> > --- a/libavformat/oggparsedaala.c
> > +++ b/libavformat/oggparsedaala.c
> > @@ -126,6 +126,7 @@ static int daala_header(AVFormatContext *s, int idx)
> >          if (hdr->gpshift >= 32) {
> >              av_log(s, AV_LOG_ERROR, "Too large gpshift %d (>= 32).\n",
> >                     hdr->gpshift);
> > +            hdr->gpshift = 0;
> >              return AVERROR_INVALIDDATA;
> >          }
> >          hdr->gpmask  = (1U << hdr->gpshift) - 1;
> > --
> > 2.11.0
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> LGTM, thanks

applied

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
index ce65b2bd7a..a373b41b4c 100644
--- a/libavformat/oggparsedaala.c
+++ b/libavformat/oggparsedaala.c
@@ -126,6 +126,7 @@  static int daala_header(AVFormatContext *s, int idx)
         if (hdr->gpshift >= 32) {
             av_log(s, AV_LOG_ERROR, "Too large gpshift %d (>= 32).\n",
                    hdr->gpshift);
+            hdr->gpshift = 0;
             return AVERROR_INVALIDDATA;
         }
         hdr->gpmask  = (1U << hdr->gpshift) - 1;