aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-26 14:33:14 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:45 +0100
commitfb12d635c5ca96eb5c164d7a0d362ff7cd17247a (patch)
treef0b8392baad867d2cd23b6838d6b4e1fafff67e2
parent351381a3e3443e6e6330cc122d3a5ee0b550bfae (diff)
downloadffmpeg-fb12d635c5ca96eb5c164d7a0d362ff7cd17247a.tar.gz
avcodec/alsdec: Fix integer overflow of raw_samples in decode_blocks()
Fixes: signed integer overflow: 2147483424 - -1772303236 cannot be represented in type 'int' Fixes: 15708/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5067890362941440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit ce652324062a2c72f92e40699797630ef7f1ec5a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alsdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 41aa051907..21282eb459 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1180,10 +1180,10 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair.\n");
for (s = 0; s < div_blocks[b]; s++)
- bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
+ bd[0].raw_samples[s] = bd[1].raw_samples[s] - (unsigned)bd[0].raw_samples[s];
} else if (bd[1].js_blocks) {
for (s = 0; s < div_blocks[b]; s++)
- bd[1].raw_samples[s] = bd[1].raw_samples[s] + bd[0].raw_samples[s];
+ bd[1].raw_samples[s] = bd[1].raw_samples[s] + (unsigned)bd[0].raw_samples[s];
}
offset += div_blocks[b];