[FFmpeg-cvslog] avcodec/adpcmenc: fix integer overflow / undefined behavior in STORE_NODE( )

Michael Niedermayer git at videolan.org
Fri Jun 6 18:11:53 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun  6 17:56:26 2014 +0200| [049b20b287397b68804649673da32043d3908b77] | committer: Michael Niedermayer

avcodec/adpcmenc: fix integer overflow / undefined behavior in STORE_NODE()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index da149a3..c3e4d0f 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -332,7 +332,7 @@ static void adpcm_compress_trellis(AVCodecContext *avctx,
                     uint8_t *h;\
                     dec_sample = av_clip_int16(dec_sample);\
                     d = sample - dec_sample;\
-                    ssd = nodes[j]->ssd + d*d;\
+                    ssd = nodes[j]->ssd + d*(unsigned)d;\
                     /* Check for wraparound, skip such samples completely. \
                      * Note, changing ssd to a 64 bit variable would be \
                      * simpler, avoiding this check, but it's slower on \



More information about the ffmpeg-cvslog mailing list