avcodec/dirac_dwt_template: Fix signedness regression in interleave()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 13 Jul 2018 16:33:08 +0000 (18:33 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 14 Jul 2018 16:02:26 +0000 (18:02 +0200)
Found-by: <jdarnley>
Tested-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dirac_dwt_template.c

index 528fc7e..2369c8d 100644 (file)
@@ -57,8 +57,8 @@ static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src
 {
     int i;
     for (i = 0; i < w2; i++) {
-        dst[2*i  ] = (src0[i] + (unsigned)add) >> shift;
-        dst[2*i+1] = (src1[i] + (unsigned)add) >> shift;
+        dst[2*i  ] = ((int)(src0[i] + (unsigned)add)) >> shift;
+        dst[2*i+1] = ((int)(src1[i] + (unsigned)add)) >> shift;
     }
 }