mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/movenc: Avoid loosing cluster array on failure
Fixes: crash
Fixes: check_pkt.mp4
Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5c2ff44f91
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d4d9c117eb
commit
61f87c7207
|
@ -5393,11 +5393,12 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
|
||||||
if (trk->entry >= trk->cluster_capacity) {
|
if (trk->entry >= trk->cluster_capacity) {
|
||||||
unsigned new_capacity = 2 * (trk->entry + MOV_INDEX_CLUSTER_SIZE);
|
unsigned new_capacity = 2 * (trk->entry + MOV_INDEX_CLUSTER_SIZE);
|
||||||
if (av_reallocp_array(&trk->cluster, new_capacity,
|
void *cluster = av_realloc_array(trk->cluster, new_capacity, sizeof(*trk->cluster));
|
||||||
sizeof(*trk->cluster))) {
|
if (!cluster) {
|
||||||
ret = AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
trk->cluster = cluster;
|
||||||
trk->cluster_capacity = new_capacity;
|
trk->cluster_capacity = new_capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue