diff mbox series

[FFmpeg-devel,1/4] avformat/matroskadec: Check duration

Message ID 20220214193934.22315-1-michael@niedermayer.cc
State Accepted
Commit 36680078ca3302496d9b0b8a8d7168ce9eabb2bc
Headers show
Series [FFmpeg-devel,1/4] avformat/matroskadec: Check duration | 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
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Feb. 14, 2022, 7:39 p.m. UTC
Fixes: -nan is outside the range of representable values of type 'long'
Fixes: 44614/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6216204841254912

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/matroskadec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andreas Rheinhardt Feb. 14, 2022, 7:56 p.m. UTC | #1
Michael Niedermayer:
> Fixes: -nan is outside the range of representable values of type 'long'
> Fixes: 44614/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6216204841254912
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/matroskadec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 91f3567692..8f0c53a6bc 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -3065,6 +3065,8 @@ static int matroska_read_header(AVFormatContext *s)
>  
>      if (!matroska->time_scale)
>          matroska->time_scale = 1000000;
> +    if (isnan(matroska->duration))
> +        matroska->duration = 0;
>      if (matroska->duration)
>          matroska->ctx->duration = matroska->duration * matroska->time_scale *
>                                    1000 / AV_TIME_BASE;

LGTM.

- Andreas
Michael Niedermayer Feb. 25, 2022, 9:19 p.m. UTC | #2
On Mon, Feb 14, 2022 at 08:56:51PM +0100, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: -nan is outside the range of representable values of type 'long'
> > Fixes: 44614/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6216204841254912
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/matroskadec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index 91f3567692..8f0c53a6bc 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -3065,6 +3065,8 @@ static int matroska_read_header(AVFormatContext *s)
> >  
> >      if (!matroska->time_scale)
> >          matroska->time_scale = 1000000;
> > +    if (isnan(matroska->duration))
> > +        matroska->duration = 0;
> >      if (matroska->duration)
> >          matroska->ctx->duration = matroska->duration * matroska->time_scale *
> >                                    1000 / AV_TIME_BASE;
> 
> LGTM.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 91f3567692..8f0c53a6bc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3065,6 +3065,8 @@  static int matroska_read_header(AVFormatContext *s)
 
     if (!matroska->time_scale)
         matroska->time_scale = 1000000;
+    if (isnan(matroska->duration))
+        matroska->duration = 0;
     if (matroska->duration)
         matroska->ctx->duration = matroska->duration * matroska->time_scale *
                                   1000 / AV_TIME_BASE;