diff mbox series

[FFmpeg-devel,01/15] avformat/concatdec: Check in/outpoint for overflow

Message ID 20230930223046.22896-1-michael@niedermayer.cc
State Accepted
Commit dedc78b4b5bdab869f3038798334639d617d2309
Headers show
Series [FFmpeg-devel,01/15] avformat/concatdec: Check in/outpoint for overflow | 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

Commit Message

Michael Niedermayer Sept. 30, 2023, 10:30 p.m. UTC
Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544

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

Comments

Nicolas George Oct. 2, 2023, 12:03 p.m. UTC | #1
Michael Niedermayer (12023-10-01):
> Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
> Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/concatdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

No objection.

Regards,
Michael Niedermayer Oct. 3, 2023, 2:11 p.m. UTC | #2
On Mon, Oct 02, 2023 at 02:03:27PM +0200, Nicolas George wrote:
> Michael Niedermayer (12023-10-01):
> > Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
> > Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/concatdec.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> No objection.

will apply
thx

[...]
Michael Niedermayer Oct. 8, 2023, 7:35 p.m. UTC | #3
On Sun, Oct 01, 2023 at 12:30:32AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
> Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/concatdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 5d4f67d0acd..114b6c6564c 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -667,7 +667,9 @@  static int concat_read_header(AVFormatContext *avf)
         else
             time = cat->files[i].start_time;
         if (cat->files[i].user_duration == AV_NOPTS_VALUE) {
-            if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE)
+            if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE ||
+                cat->files[i].outpoint - (uint64_t)cat->files[i].inpoint != av_sat_sub64(cat->files[i].outpoint, cat->files[i].inpoint)
+            )
                 break;
             cat->files[i].user_duration = cat->files[i].outpoint - cat->files[i].inpoint;
         }