mirror of https://github.com/mpv-player/mpv
dec_sub: always copy packet for new segments
Since 062104d16e
, we started saving cached
packets for subtitles. However, these can point to the same address as
what is stored in sub->new_segment. When a segment is updated, the
packet is potentially freed. Later during decoding, this can lead to a
double free since the cached packets will naturally try to free itself
and update. Fix this by simply always making sub->new_segment a full
copy of the packet so its lifetime doesn't have to be tied to the cached
packet stuff.
This commit is contained in:
parent
a96d04f19d
commit
ad26c3b0a5
|
@ -321,7 +321,7 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts, bool force)
|
|||
sub->last_pkt_pts = pkt->pts;
|
||||
|
||||
if (is_new_segment(sub, pkt)) {
|
||||
sub->new_segment = pkt;
|
||||
sub->new_segment = demux_copy_packet(pkt);
|
||||
// Note that this can be delayed to a much later point in time.
|
||||
update_segment(sub);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue