mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
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@gmail.com>
This commit is contained in:
parent
a45ba0881c
commit
1b9b469cdb
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user