[FFmpeg-cvslog] avcodec/ilbcdec: Fix undefined integer overflow lsf2poly()
Michael Niedermayer
git at videolan.org
Mon Jan 28 02:24:17 EET 2019
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Jan 15 00:09:30 2019 +0100| [4523cc5e75c8ecfba8975d16e96c29f9bf70973f] | committer: Michael Niedermayer
avcodec/ilbcdec: Fix undefined integer overflow lsf2poly()
The addition is moved up into the context where the variable is unsigned avoiding
the undefined behavior
Fixes: runtime error: signed integer overflow: 2147481972 + 4096 cannot be represented in type 'int'
Fixes: 12444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-5755706244857856
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4523cc5e75c8ecfba8975d16e96c29f9bf70973f
---
libavcodec/ilbcdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/ilbcdec.c b/libavcodec/ilbcdec.c
index 643547f4ab..bba83a5896 100644
--- a/libavcodec/ilbcdec.c
+++ b/libavcodec/ilbcdec.c
@@ -408,11 +408,11 @@ static void lsf2poly(int16_t *a, int16_t *lsf)
a[0] = 4096;
for (i = 5; i > 0; i--) {
- tmp = f[0][6 - i] + (unsigned)f[1][6 - i];
- a[6 - i] = (tmp + 4096) >> 13;
+ tmp = f[0][6 - i] + (unsigned)f[1][6 - i] + 4096;
+ a[6 - i] = tmp >> 13;
- tmp = f[0][6 - i] - (unsigned)f[1][6 - i];
- a[5 + i] = (tmp + 4096) >> 13;
+ tmp = f[0][6 - i] - (unsigned)f[1][6 - i] + 4096;
+ a[5 + i] = tmp >> 13;
}
}
More information about the ffmpeg-cvslog
mailing list