mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/cbs: Allocate more CodedBitstreamUnit at once in cbs_insert_unit()
Fixes: Timeout (85sec -> 0.5sec) Fixes: 20791/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_FRAME_SPLIT_fuzzer-5659537719951360 Fixes: 21214/clusterfuzz-testcase-minimized-ffmpeg_BSF_MPEG2_METADATA_fuzzer-5165560875974656 Fixes: 21247/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-5715175257931776 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
bf446711bc
commit
49ba60fed0
@ -693,11 +693,11 @@ static int cbs_insert_unit(CodedBitstreamContext *ctx,
|
||||
memmove(units + position + 1, units + position,
|
||||
(frag->nb_units - position) * sizeof(*units));
|
||||
} else {
|
||||
units = av_malloc_array(frag->nb_units + 1, sizeof(*units));
|
||||
units = av_malloc_array(frag->nb_units*2 + 1, sizeof(*units));
|
||||
if (!units)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
++frag->nb_units_allocated;
|
||||
frag->nb_units_allocated = 2*frag->nb_units_allocated + 1;
|
||||
|
||||
if (position > 0)
|
||||
memcpy(units, frag->units, position * sizeof(*units));
|
||||
|
Loading…
Reference in New Issue
Block a user