aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-09-25 14:21:07 -0300
committerMichael Niedermayer <michael@niedermayer.cc>2022-05-04 18:31:05 +0200
commit02161c6ed194ddfa00fd2af7684a8099852bc3ce (patch)
tree1c1960167a6f32950ca468b0364e35d713a6f5ed
parent3d350ec7281cd0d357231fc2c99f44ebe425d586 (diff)
downloadffmpeg-02161c6ed194ddfa00fd2af7684a8099852bc3ce.tar.gz
aformat/movenc: add missing padding to output track extradata
Fixes ticket #8183. Tested-by: Thierry Foucu <tfoucu@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 58aa0ed8f10753ee90f4a4a1f4f3da803cf7c145) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/movenc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f600285862..e73d5a3cdb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4398,12 +4398,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
!TAG_IS_AVCI(trk->tag) &&
(enc->codec_id != AV_CODEC_ID_DNXHD)) {
trk->vos_len = enc->extradata_size;
- trk->vos_data = av_malloc(trk->vos_len);
+ trk->vos_data = av_malloc(trk->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
if (!trk->vos_data) {
ret = AVERROR(ENOMEM);
goto err;
}
memcpy(trk->vos_data, enc->extradata, trk->vos_len);
+ memset(trk->vos_data + trk->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
@@ -4452,12 +4453,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
enc->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
/* copy frame to create needed atoms */
trk->vos_len = size;
- trk->vos_data = av_malloc(size);
+ trk->vos_data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!trk->vos_data) {
ret = AVERROR(ENOMEM);
goto err;
}
memcpy(trk->vos_data, pkt->data, size);
+ memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
if (trk->entry >= trk->cluster_capacity) {
@@ -4962,12 +4964,13 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
cur += strspn(cur, "\n\r");
}
if (have_palette) {
- track->vos_data = av_malloc(16*4);
+ track->vos_data = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
if (!track->vos_data)
return AVERROR(ENOMEM);
for (i = 0; i < 16; i++) {
AV_WB32(track->vos_data + i * 4, palette[i]);
}
+ memset(track->vos_data + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
track->vos_len = 16 * 4;
}
st->codec->width = width;
@@ -5226,12 +5229,13 @@ static int mov_write_header(AVFormatContext *s)
mov_create_dvd_sub_decoder_specific_info(track, st);
else if (!TAG_IS_AVCI(track->tag) && st->codec->codec_id != AV_CODEC_ID_DNXHD) {
track->vos_len = st->codec->extradata_size;
- track->vos_data = av_malloc(track->vos_len);
+ track->vos_data = av_malloc(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
if (!track->vos_data) {
ret = AVERROR(ENOMEM);
goto error;
}
memcpy(track->vos_data, st->codec->extradata, track->vos_len);
+ memset(track->vos_data + track->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
}
}