mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/cscd: Error out when LZ* decompression fails
Fixes: Timeout Fixes: 6304/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-5754772461191168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
c6c20249e7
commit
d52be5d4e9
|
@ -81,15 +81,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
switch ((buf[0] >> 1) & 7) {
|
switch ((buf[0] >> 1) & 7) {
|
||||||
case 0: { // lzo compression
|
case 0: { // lzo compression
|
||||||
int outlen = c->decomp_size, inlen = buf_size - 2;
|
int outlen = c->decomp_size, inlen = buf_size - 2;
|
||||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
|
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: { // zlib compression
|
case 1: { // zlib compression
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
unsigned long dlen = c->decomp_size;
|
unsigned long dlen = c->decomp_size;
|
||||||
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
|
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
|
av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
|
av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
|
||||||
|
|
Loading…
Reference in New Issue