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>
This commit is contained in:
Andreas Rheinhardt 2022-07-04 18:53:50 +02:00
parent dc977f94d5
commit a256426411
1 changed files with 3 additions and 0 deletions

View File

@ -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];
}