OSDN Git Service

avcodec/adpcmenc: fix integer overflow / undefined behavior in STORE_NODE()
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Jun 2014 15:56:26 +0000 (17:56 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Jun 2014 16:03:31 +0000 (18:03 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/adpcmenc.c

index da149a3..c3e4d0f 100644 (file)
@@ -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 \