diff mbox series

[FFmpeg-devel,1/2] oavformat/avidec_ Check offset in odml

Message ID 20210919203536.23964-1-michael@niedermayer.cc
State Accepted
Commit 255a7b423ed5e07536bdc72e993056daa4efe009
Headers show
Series [FFmpeg-devel,1/2] oavformat/avidec_ Check offset in odml
Related show

Checks

Context Check Description
andriy/commit_msg_x86 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/commit_msg_ppc warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Sept. 19, 2021, 8:35 p.m. UTC
Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long'
Fixes: 38787/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-4859845799444480

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

Comments

Michael Niedermayer Oct. 7, 2021, 9:04 p.m. UTC | #1
On Sun, Sep 19, 2021 at 10:35:35PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long'
> Fixes: 38787/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-4859845799444480
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/avidec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 3eb5d4dff5f..1e8efc13060 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -244,7 +244,7 @@  static int read_odml_index(AVFormatContext *s, int64_t frame_num)
             avio_rl32(pb);       /* size */
             duration = avio_rl32(pb);
 
-            if (avio_feof(pb))
+            if (avio_feof(pb) || offset > INT64_MAX - 8)
                 return AVERROR_INVALIDDATA;
 
             pos = avio_tell(pb);