[FFmpeg-cvslog] avcodec/mpeg4_unpack_bframes: make sure the packet is writable when data needs to be changed
James Almer
git at videolan.org
Wed Mar 28 07:47:50 EEST 2018
ffmpeg | branch: release/3.4 | James Almer <jamrial at gmail.com> | Wed Mar 28 01:42:33 2018 -0300| [1b9b469cdb1f2dbf7692b8c1a63257899f6c8f19] | 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.
Based on commit 4f2ff3a53e170d77e1dd231d7246a74e186011c9
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b9b469cdb1f2dbf7692b8c1a63257899f6c8f19
---
libavcodec/mpeg4_unpack_bframes_bsf.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c
index e227f58ec6..8be5c462b5 100644
--- a/libavcodec/mpeg4_unpack_bframes_bsf.c
+++ b/libavcodec/mpeg4_unpack_bframes_bsf.c
@@ -152,8 +152,16 @@ 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_new_packet(out, in->size);
+ if (ret < 0)
+ return ret;
+ ret = av_packet_copy_props(out, in);
+ if (ret < 0) {
+ av_packet_unref(out);
+ return ret;
+ }
+ memcpy(out->data, in->data, in->size);
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 */
out->data[pos_p] = '\0';
} else {
More information about the ffmpeg-cvslog
mailing list