diff mbox series

[FFmpeg-devel,3/5] avformat/flvdec: timestamps cannot use the full int64 range

Message ID 20211223211527.20408-3-michael@niedermayer.cc
State Accepted
Commit c217ca7718c8e24905d7ba9ede719ae040899476
Headers show
Series [FFmpeg-devel,1/5] avcodec/targa: Check input size for uncompressed TGA before allocation | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Michael Niedermayer Dec. 23, 2021, 9:15 p.m. UTC
We do not support this as we multiply by 1000
Fixes: signed integer overflow: -45318575073853696 * 1000 cannot be represented in type 'long'
Fixes: 42804/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4630325425209344

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

Comments

Michael Niedermayer Dec. 30, 2021, 8:44 p.m. UTC | #1
On Thu, Dec 23, 2021 at 10:15:25PM +0100, Michael Niedermayer wrote:
> We do not support this as we multiply by 1000
> Fixes: signed integer overflow: -45318575073853696 * 1000 cannot be represented in type 'long'
> Fixes: 42804/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4630325425209344
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/flvdec.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 44a7e5f93cc..b9e36b3ff1b 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -461,6 +461,8 @@  static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m
             d = av_int2double(avio_rb64(ioc));
             if (isnan(d) || d < INT64_MIN || d > INT64_MAX)
                 goto invalid;
+            if (current_array == &times && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000))
+                goto invalid;
             current_array[0][i] = d;
         }
         if (times && filepositions) {