@@ -149,8 +149,14 @@ 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)
+ goto fail;
+ ret = av_packet_copy_props(out, in);
+ if (ret < 0)
+ goto fail;
+ 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 {
Nothing currently guarantees that the packet will be writtable. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/mpeg4_unpack_bframes_bsf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)