diff mbox series

[FFmpeg-devel,4/7] avformat/mxfdec: Check timecode for overflow

Message ID 20240912233337.2444412-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/mov_chan: Check for FF_SANE_NB_CHANNELS | 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. 12, 2024, 11:33 p.m. UTC
Fixes: signed integer overflow: 9223372036840103968 + 538976288 cannot be represented in type 'long'
Fixes: 70604/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4844090340999168

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

Comments

Tomas Härdin Sept. 15, 2024, 6:28 p.m. UTC | #1
fre 2024-09-13 klockan 01:33 +0200 skrev Michael Niedermayer:
> Fixes: signed integer overflow: 9223372036840103968 + 538976288
> cannot be represented in type 'long'
> Fixes: 70604/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-
> 4844090340999168
> 
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mxfdec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index ac63c0d5add..8eae9f87afa 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -2391,6 +2391,9 @@ static int
> mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
>                                                physical_track-
> >edit_rate,
>                                                source_track-
> >edit_rate);
>  
> +                if (av_sat_add64(start_position, mxf_tc-
> >start_frame) != start_position + (uint64_t)mxf_tc->start_frame)
> +                    continue;

Should error out instead IMO

/Tomas
diff mbox series

Patch

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index ac63c0d5add..8eae9f87afa 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2391,6 +2391,9 @@  static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
                                               physical_track->edit_rate,
                                               source_track->edit_rate);
 
+                if (av_sat_add64(start_position, mxf_tc->start_frame) != start_position + (uint64_t)mxf_tc->start_frame)
+                    continue;
+
                 if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) {
                     mxf_add_timecode_metadata(&st->metadata, "timecode", &tc);
                     return 0;