summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4_unpack_bframes_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-21 22:37:46 -0300
committerJames Almer <jamrial@gmail.com>2018-03-22 16:41:10 -0300
commit4f2ff3a53e170d77e1dd231d7246a74e186011c9 (patch)
tree008406995dcafaf44ea886330b076c58c931f432 /libavcodec/mpeg4_unpack_bframes_bsf.c
parent65616bc191b110af6a81aa38b1d15aa9879d8cbc (diff)
downloadffmpeg-4f2ff3a53e170d77e1dd231d7246a74e186011c9.tar.gz
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@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/mpeg4_unpack_bframes_bsf.c')
-rw-r--r--libavcodec/mpeg4_unpack_bframes_bsf.c3
1 files changed, 3 insertions, 0 deletions
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 */