[FFmpeg-cvslog] avformat/movenc: Ensure packet is writable before modifying it

Andreas Rheinhardt git at videolan.org
Sat Jul 9 20:46:14 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Jul  4 18:53:50 2022 +0200| [a2564264116aabc5a95755ca93a31508ef547f40] | committer: Andreas Rheinhardt

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 at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2564264116aabc5a95755ca93a31508ef547f40
---

 libavformat/movenc.c | 3 +++
 1 file changed, 3 insertions(+)

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



More information about the ffmpeg-cvslog mailing list