[FFmpeg-cvslog] avcodec/mpeg4_unpack_bframes: make sure the packet is writable when data needs to be changed

James Almer git at videolan.org
Thu Mar 22 21:42:21 EET 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Mar 21 22:37:46 2018 -0300| [4f2ff3a53e170d77e1dd231d7246a74e186011c9] | committer: James Almer

avcodec/mpeg4_unpack_bframes: make sure the packet is writable when data needs to be changed

Nothing currently guarantees that the packet passed to the bsf will
be writable.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/mpeg4_unpack_bframes_bsf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c
index ba970794c5..3a0ba105f5 100644
--- a/libavcodec/mpeg4_unpack_bframes_bsf.c
+++ b/libavcodec/mpeg4_unpack_bframes_bsf.c
@@ -149,6 +149,9 @@ static int mpeg4_unpack_bframes_filter(AVBSFContext *ctx, AVPacket *out)
         av_packet_move_ref(out, in);
         out->size = pos_vop2;
     } else if (pos_p >= 0) {
+        ret = av_packet_make_writable(in);
+        if (ret < 0)
+            goto fail;
         av_log(ctx, AV_LOG_DEBUG, "Updating DivX userdata (remove trailing 'p').\n");
         av_packet_move_ref(out, in);
         /* remove 'p' (packed) from the end of the (DivX) userdata string */



More information about the ffmpeg-cvslog mailing list