diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-11-02 20:34:09 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-01-09 01:19:14 +0300 |
commit | d857f1035bfe59e99c3bb520523144d0f3db815b (patch) | |
tree | 47c016a72f0392657e63d8c08b6a00fe4dfde6e2 | |
parent | 4730046891069c80bdcf773972d2c91f1dc31327 (diff) |
avcodec/cngdec: Fix integer clipping
Fixes: runtime error: value -36211.7 is outside the range of representable values of type 'short'
Fixes: 2992/clusterfuzz-testcase-6649611793989632
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 51090133b31bc719ea868db15d3ee38e9dbe90f1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/cngdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c index 34f881448d..42ef5bb3db 100644 --- a/libavcodec/cngdec.c +++ b/libavcodec/cngdec.c @@ -147,7 +147,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data, return ret; buf_out = (int16_t *)frame->data[0]; for (i = 0; i < avctx->frame_size; i++) - buf_out[i] = p->filter_out[i + p->order]; + buf_out[i] = av_clip_int16(p->filter_out[i + p->order]); memcpy(p->filter_out, p->filter_out + avctx->frame_size, p->order * sizeof(*p->filter_out)); |