mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/cinepak: Check input packet size before frame reallocation
Reduces time spend decoding 1917/clusterfuzz-testcase-minimized-5023221273329664 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
6726328f79
commit
e47057e932
@ -322,9 +322,6 @@ static int cinepak_decode (CinepakContext *s)
|
|||||||
int y0 = 0;
|
int y0 = 0;
|
||||||
int encoded_buf_size;
|
int encoded_buf_size;
|
||||||
|
|
||||||
if (s->size < 10)
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
|
|
||||||
frame_flags = s->data[0];
|
frame_flags = s->data[0];
|
||||||
num_strips = AV_RB16 (&s->data[8]);
|
num_strips = AV_RB16 (&s->data[8]);
|
||||||
encoded_buf_size = AV_RB24(&s->data[1]);
|
encoded_buf_size = AV_RB24(&s->data[1]);
|
||||||
@ -439,6 +436,9 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
|||||||
s->data = buf;
|
s->data = buf;
|
||||||
s->size = buf_size;
|
s->size = buf_size;
|
||||||
|
|
||||||
|
if (s->size < 10)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user