mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 01:40:04 +01:00
Fix read-after-free in matroska_read_seek().
In matroska_read_seek(), |tracks| is assigned at the begining of the function.
However, functions like matroska_parse_cues() could reallocate the tracks so
that |tracks| can get invalidated.
This CL assigns |tracks| only before we use it so that it won't be invalidated.
BUG=427266
TEST=Test case in associated bug passes now.
Change-Id: I9c7065fe8f4311ca846076281df2282d190ed344
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 33301f0017)
Conflicts:
libavformat/matroskadec.c
This commit is contained in:
committed by
Michael Niedermayer
parent
c9edf502cd
commit
46ee330d3a
@@ -2587,7 +2587,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
|||||||
int64_t timestamp, int flags)
|
int64_t timestamp, int flags)
|
||||||
{
|
{
|
||||||
MatroskaDemuxContext *matroska = s->priv_data;
|
MatroskaDemuxContext *matroska = s->priv_data;
|
||||||
MatroskaTrack *tracks = matroska->tracks.elem;
|
MatroskaTrack *tracks = NULL;
|
||||||
AVStream *st = s->streams[stream_index];
|
AVStream *st = s->streams[stream_index];
|
||||||
int i, index, index_sub, index_min;
|
int i, index, index_sub, index_min;
|
||||||
|
|
||||||
@@ -2616,6 +2616,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
index_min = index;
|
index_min = index;
|
||||||
|
tracks = matroska->tracks.elem;
|
||||||
for (i=0; i < matroska->tracks.nb_elem; i++) {
|
for (i=0; i < matroska->tracks.nb_elem; i++) {
|
||||||
tracks[i].audio.pkt_cnt = 0;
|
tracks[i].audio.pkt_cnt = 0;
|
||||||
tracks[i].audio.sub_packet_cnt = 0;
|
tracks[i].audio.sub_packet_cnt = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user