diff mbox

[FFmpeg-devel,2/6] avcodec/shorten: Fix integer overflow in residual/LPC combination

Message ID 20180813002423.10292-2-michael@niedermayer.cc
State Accepted
Commit db7e9082e1a1479c6a8844f7adf77eae03cc2aa7
Headers show

Commit Message

Michael Niedermayer Aug. 13, 2018, 12:24 a.m. UTC
Fixes: signed integer overflow: -540538872 + -2012739576 cannot be represented in type 'int'
Fixes: 9255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5758630052757504

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

Comments

Michael Niedermayer Aug. 15, 2018, 11:01 p.m. UTC | #1
On Mon, Aug 13, 2018 at 02:24:19AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -540538872 + -2012739576 cannot be represented in type 'int'
> Fixes: 9255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5758630052757504
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 9094d3fc55..054494f8ce 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -391,7 +391,7 @@  static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
         for (j = 0; j < pred_order; j++)
             sum += coeffs[j] * (unsigned)s->decoded[channel][i - j - 1];
         s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) +
-                                 (sum >> qshift);
+                                 (unsigned)(sum >> qshift);
     }
 
     /* add offset to current samples */