[FFmpeg-cvslog] avformat/movenc: Avoid loosing cluster array on failure
Michael Niedermayer
git at videolan.org
Fri Mar 26 17:05:31 EET 2021
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Mar 18 18:01:52 2021 +0100| [5c2ff44f915d6ceeea36a2f99e534562764218dd] | committer: Michael Niedermayer
avformat/movenc: Avoid loosing cluster array on failure
Fixes: crash
Fixes: check_pkt.mp4
Found-by: Rafael Dutra <rafael.dutra at cispa.de>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c2ff44f915d6ceeea36a2f99e534562764218dd
---
libavformat/movenc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6790fe6c45..bade57dcea 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5746,11 +5746,12 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
if (trk->entry >= trk->cluster_capacity) {
unsigned new_capacity = trk->entry + MOV_INDEX_CLUSTER_SIZE;
- if (av_reallocp_array(&trk->cluster, new_capacity,
- sizeof(*trk->cluster))) {
+ void *cluster = av_realloc_array(trk->cluster, new_capacity, sizeof(*trk->cluster));
+ if (!cluster) {
ret = AVERROR(ENOMEM);
goto err;
}
+ trk->cluster = cluster;
trk->cluster_capacity = new_capacity;
}
More information about the ffmpeg-cvslog
mailing list