aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-03 15:54:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-03 16:37:10 +0200
commit042260cde4ecf716438c5fc92d15ad5f037ee2e1 (patch)
tree6c8c688b8c9569ef97d1265c7b61a19aaad23ccb
parent52835cb8e16cd54bd4b3052279f184882cbf54c2 (diff)
downloadffmpeg-042260cde4ecf716438c5fc92d15ad5f037ee2e1.tar.gz
avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow and undefined behavior in fate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/wavpack.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 1ad3901600..b51a21cc9d 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -472,6 +472,14 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
s->decorr[i].samplesB[0] = L;
}
}
+
+ if (type == AV_SAMPLE_FMT_S16P) {
+ if (FFABS(L) + FFABS(R) > (1<<19)) {
+ av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
pos = (pos + 1) & 7;
if (s->joint)
L += (R -= (L >> 1));