[FFmpeg-cvslog] avcodec/apac: use unsigned for sample residual

Michael Niedermayer git at videolan.org
Mon Nov 28 22:32:24 EET 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Nov 16 22:01:34 2022 +0100| [b2c1a0fc2b196d4cdbaae5b120229138857b559f] | committer: Michael Niedermayer

avcodec/apac: use unsigned for sample residual

Fixes: signed integer overflow: -2146670226 + -2227242 cannot be represented in type 'int'
Fixes: 51943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5779018251370496

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=b2c1a0fc2b196d4cdbaae5b120229138857b559f
---

 libavcodec/apac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apac.c b/libavcodec/apac.c
index 784abb622c..030f81adce 100644
--- a/libavcodec/apac.c
+++ b/libavcodec/apac.c
@@ -208,7 +208,7 @@ static int apac_decode(AVCodecContext *avctx, AVFrame *frame,
 
             for (int i = 0; i < c->block_length; i++) {
                 int val = get_bits_long(gb, c->bit_length);
-                int delta = (val & 1) ? ~(val >> 1) : (val >> 1);
+                unsigned delta = (val & 1) ? ~(val >> 1) : (val >> 1);
                 int sample;
 
                 delta += c->last_delta;



More information about the ffmpeg-cvslog mailing list