Browse Source

avcodec/wavpack: Fix integer overflow in DEC_MED() / INC_MED()

Fixes: runtime error: signed integer overflow: 2147483637 + 128 cannot be represented in type 'int'
Fixes: 6701/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5358324934508544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.1
Michael Niedermayer 7 years ago
parent
commit
6e95d80e6f
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/wavpack.h

+ 2
- 2
libavcodec/wavpack.h View File

@@ -99,8 +99,8 @@ typedef struct WvChannel {


// macros for manipulating median values // macros for manipulating median values
#define GET_MED(n) ((c->median[n] >> 4) + 1) #define GET_MED(n) ((c->median[n] >> 4) + 1)
#define DEC_MED(n) c->median[n] -= ((c->median[n] + (128 >> (n)) - 2) / (128 >> (n))) * 2U
#define INC_MED(n) c->median[n] += ((c->median[n] + (128 >> (n)) ) / (128 >> (n))) * 5U
#define DEC_MED(n) c->median[n] -= ((int)(c->median[n] + (128U >> (n)) - 2) / (128 >> (n))) * 2U
#define INC_MED(n) c->median[n] += ((int)(c->median[n] + (128U >> (n)) ) / (128 >> (n))) * 5U


// macros for applying weight // macros for applying weight
#define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \ #define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \


Loading…
Cancel
Save