mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-02 18:48:27 +00:00
rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
This fixes crashes when playing back certain RealRTSP streams.
When invoked from the RTP depacketizer, the full realmedia
demuxer isn't invoked, but only certain functions from it, where
a separate AVIOContext is passed in as parameter (for the buffer
containing the data to parse). The functions called from within
those entry points should only be using that parameter, not
s->pb. In the depacketizer case, s is the RTSP context, where ->pb
is null.
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d35b6cd377
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
002ca3e099
commit
a747cf8873
@ -93,13 +93,13 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rm_read_metadata(AVFormatContext *s, int wide)
|
||||
static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide)
|
||||
{
|
||||
char buf[1024];
|
||||
int i;
|
||||
for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
|
||||
int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);
|
||||
get_strl(s->pb, buf, sizeof(buf), len);
|
||||
int len = wide ? avio_rb16(pb) : avio_r8(pb);
|
||||
get_strl(pb, buf, sizeof(buf), len);
|
||||
av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0);
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
int header_size = avio_rb16(pb);
|
||||
int64_t startpos = avio_tell(pb);
|
||||
avio_skip(pb, 14);
|
||||
rm_read_metadata(s, 0);
|
||||
rm_read_metadata(s, pb, 0);
|
||||
if ((startpos + header_size) >= avio_tell(pb) + 2) {
|
||||
// fourcc (should always be "lpcJ")
|
||||
avio_r8(pb);
|
||||
@ -276,7 +276,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
avio_r8(pb);
|
||||
avio_r8(pb);
|
||||
avio_r8(pb);
|
||||
rm_read_metadata(s, 0);
|
||||
rm_read_metadata(s, pb, 0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -471,7 +471,7 @@ static int rm_read_header(AVFormatContext *s)
|
||||
flags = avio_rb16(pb); /* flags */
|
||||
break;
|
||||
case MKTAG('C', 'O', 'N', 'T'):
|
||||
rm_read_metadata(s, 1);
|
||||
rm_read_metadata(s, pb, 1);
|
||||
break;
|
||||
case MKTAG('M', 'D', 'P', 'R'):
|
||||
st = avformat_new_stream(s, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user