diff mbox series

[FFmpeg-devel,3/5] avformat/mpc8: correct integer overflow in mpc8_parse_seektable()

Message ID 20201030215206.1629-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avformat/argo_brp: Check block align before use
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 30, 2020, 9:52 p.m. UTC
Fixes: signed integer overflow: -4683718486770919638 * 2 cannot be represented in type 'long'
Fixes: 26704/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6327056939614208

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

Comments

Michael Niedermayer Nov. 26, 2020, 12:41 a.m. UTC | #1
On Fri, Oct 30, 2020 at 10:52:04PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -4683718486770919638 * 2 cannot be represented in type 'long'
> Fixes: 26704/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6327056939614208
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mpc8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 0002e2a9dd..ae5cbc0cbf 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -182,7 +182,7 @@  static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
         t += get_bits(&gb, 12);
         if(t & 1)
             t = -(t & ~1);
-        pos = (t >> 1) + ppos[0]*2 - ppos[1];
+        pos = (t >> 1) + (uint64_t)ppos[0]*2 - ppos[1];
         av_add_index_entry(s->streams[0], pos, i << seekd, 0, 0, AVINDEX_KEYFRAME);
         ppos[1] = ppos[0];
         ppos[0] = pos;