mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/targa: Do not return images when there is no image in the tga
Fixes: Timeout Fixes: 35877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TARGA_fuzzer-5407292819374080 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
a4af92d7cb
commit
1e85a698c0
@ -176,6 +176,10 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
|
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if ((compr & (~TGA_RLE)) == TGA_NODATA) {
|
||||||
|
return avpkt->size;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
p->pict_type = AV_PICTURE_TYPE_I;
|
p->pict_type = AV_PICTURE_TYPE_I;
|
||||||
@ -242,9 +246,6 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((compr & (~TGA_RLE)) == TGA_NODATA) {
|
|
||||||
memset(p->data[0], 0, p->linesize[0] * h);
|
|
||||||
} else {
|
|
||||||
if (compr & TGA_RLE) {
|
if (compr & TGA_RLE) {
|
||||||
int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave);
|
int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
@ -289,7 +290,6 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user