diff mbox

[FFmpeg-devel,1/3] avformat/oggparsedaala: Check duration for AV_NOPTS_VALUE

Message ID 20170401171836.32701-1-michael@niedermayer.cc
State Accepted
Commit 679a315424e6ffaafd21ebf7a86108bd4e743793
Headers show

Commit Message

Michael Niedermayer April 1, 2017, 5:18 p.m. UTC
This avoids an integer overflow
the solution matches oggparsevorbis.c and 45581ed15d2ad5955e24d809820c1675da68f500

Fixes: 700242

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

Comments

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

> This avoids an integer overflow
> the solution matches oggparsevorbis.c and 45581ed15d2ad5955e24d809820c16
> 75da68f500
>
> Fixes: 700242
>
> Found-by: Thomas Guilbert <tguilbert@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/oggparsedaala.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
> index 89bda58994..ce65b2bd7a 100644
> --- a/libavformat/oggparsedaala.c
> +++ b/libavformat/oggparsedaala.c
> @@ -232,7 +232,7 @@ static int daala_packet(AVFormatContext *s, int idx)
>          os->lastpts = os->lastdts = daala_gptopts(s, idx, os->granule,
> NULL) - duration;
>          if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
>              s->streams[idx]->start_time = os->lastpts;
> -            if (s->streams[idx]->duration)
> +            if (s->streams[idx]->duration != AV_NOPTS_VALUE)
>                  s->streams[idx]->duration -= s->streams[idx]->start_time;
>          }
>      }
> --
> 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:05:10PM +0100, Rostislav Pehlivanov wrote:
> On 1 April 2017 at 18:18, Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > This avoids an integer overflow
> > the solution matches oggparsevorbis.c and 45581ed15d2ad5955e24d809820c16
> > 75da68f500
> >
> > Fixes: 700242
> >
> > Found-by: Thomas Guilbert <tguilbert@google.com>
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/oggparsedaala.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
> > index 89bda58994..ce65b2bd7a 100644
> > --- a/libavformat/oggparsedaala.c
> > +++ b/libavformat/oggparsedaala.c
> > @@ -232,7 +232,7 @@ static int daala_packet(AVFormatContext *s, int idx)
> >          os->lastpts = os->lastdts = daala_gptopts(s, idx, os->granule,
> > NULL) - duration;
> >          if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
> >              s->streams[idx]->start_time = os->lastpts;
> > -            if (s->streams[idx]->duration)
> > +            if (s->streams[idx]->duration != AV_NOPTS_VALUE)
> >                  s->streams[idx]->duration -= s->streams[idx]->start_time;
> >          }
> >      }
> > --
> > 2.11.0
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> LGTM, thanks

applied

thx

[...]
diff mbox

Patch

diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
index 89bda58994..ce65b2bd7a 100644
--- a/libavformat/oggparsedaala.c
+++ b/libavformat/oggparsedaala.c
@@ -232,7 +232,7 @@  static int daala_packet(AVFormatContext *s, int idx)
         os->lastpts = os->lastdts = daala_gptopts(s, idx, os->granule, NULL) - duration;
         if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
             s->streams[idx]->start_time = os->lastpts;
-            if (s->streams[idx]->duration)
+            if (s->streams[idx]->duration != AV_NOPTS_VALUE)
                 s->streams[idx]->duration -= s->streams[idx]->start_time;
         }
     }