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>
pull/283/head
James Almer 7 years ago
parent 65616bc191
commit 4f2ff3a53e
  1. 3
      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 */

Loading…
Cancel
Save