diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-03 15:54:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-17 21:50:09 +0200 |
commit | 45ea5ba0686c23020abf2190b0c2af8cb6b8cf27 (patch) | |
tree | 09907f9134f57ef64d971a2dce9b05179cba1fab /libavcodec | |
parent | ffdd93fe79b708b7fdef378d34951e7c8c0d7f6b (diff) | |
download | ffmpeg-45ea5ba0686c23020abf2190b0c2af8cb6b8cf27.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>
(cherry picked from commit 042260cde4ecf716438c5fc92d15ad5f037ee2e1)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/wavpack.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 0428b05128..c4b4e52e0b 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)); |