summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-04 18:53:50 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-09 19:37:53 +0200
commita2564264116aabc5a95755ca93a31508ef547f40 (patch)
tree931dd82597597c9d3b4051c8e2f6e314e37c9b15 /libavformat/movenc.c
parentdc977f94d52ee91ce0910d4310f622a043701576 (diff)
downloadffmpeg-a2564264116aabc5a95755ca93a31508ef547f40.tar.gz
avformat/movenc: Ensure packet is writable before modifying it
Fixes e.g. ffmpeg -i fate-suite/h264/bbc2.sample.h264 -c:v rawvideo -map 0:v -frames:v 10 -pix_fmt gray8 -f tee "first.mov|second.mov" Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a4dace7c1d..5608afde42 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6513,6 +6513,9 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
} else if (trk->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
(trk->par->format == AV_PIX_FMT_GRAY8 ||
trk->par->format == AV_PIX_FMT_MONOBLACK)) {
+ ret = av_packet_make_writable(pkt);
+ if (ret < 0)
+ goto fail;
for (i = 0; i < pkt->size; i++)
pkt->data[i] = ~pkt->data[i];
}