mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
avformat/mux: Sanitize packets without data and side-data
The BSF API treats such packets as signalling EOF and therefore such a packet might corrupt the BSF state. In such a case, the guarantee that av_interleaved_write_frame() always frees the packet is not upheld. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
f801207568
commit
805ec95f8e
@ -787,6 +787,13 @@ static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||
if (sti->is_intra_only)
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
|
||||
if (!pkt->data && !pkt->side_data_elems) {
|
||||
/* Such empty packets signal EOS for the BSF API; so sanitize
|
||||
* the packet by allocating data of size 0 (+ padding). */
|
||||
av_buffer_unref(&pkt->buf);
|
||||
return av_packet_make_refcounted(pkt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user