[FFmpeg-cvslog] avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()

Michael Niedermayer git at videolan.org
Sat Apr 25 23:32:35 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Apr 24 22:55:55 2020 +0200| [cca0436efc4ea662087690f5d1b0834fd39b1559] | committer: Michael Niedermayer

avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()

Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int32_t' (aka 'int')
Fixes: 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248

Change to int16_t suggested by Lynne

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev at lynne.ee>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cca0436efc4ea662087690f5d1b0834fd39b1559
---

 libavcodec/dirac_vlc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index fbe28017bc..2e2fa7ea63 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -1095,7 +1095,7 @@ int ff_dirac_golomb_read_16bit(const uint8_t *buf, int bytes,
 {
     LUTState lut = ff_dirac_golomb_lut[*buf++];
     int16_t *dst = (int16_t *)_dst, *last = dst + coeffs;
-    int16_t val = 0;
+    uint16_t val = 0;
 
     for (int i = 1; i < bytes; i++)
         PROCESS_VALS;
@@ -1115,7 +1115,7 @@ int ff_dirac_golomb_read_32bit(const uint8_t *buf, int bytes,
 {
     LUTState lut = ff_dirac_golomb_lut[*buf++];
     int32_t *dst = (int32_t *)_dst, *last = dst + coeffs;
-    int32_t val = 0;
+    uint32_t val = 0;
 
     for (int i = 1; i < bytes; i++)
         PROCESS_VALS;



More information about the ffmpeg-cvslog mailing list