diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-04 22:20:46 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-25 23:01:53 +0200 |
commit | e75ab15fd4579e7b4d5b12d756caeee338f0f62c (patch) | |
tree | 4fd7d837abcee169d8019103fbccea39932649dc | |
parent | 7cfff1512c41a95f50a020854d40c813b9a8b1ec (diff) | |
download | ffmpeg-e75ab15fd4579e7b4d5b12d756caeee338f0f62c.tar.gz |
avformat/matroskadec: Read RealAudio extradata directly
Don't use the avio-API to read a few bytes at fixed offsets.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavformat/matroskadec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 01104dbda7..c33128f528 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2660,18 +2660,18 @@ static int matroska_parse_tracks(AVFormatContext *s) codec_id == AV_CODEC_ID_ATRAC3 || codec_id == AV_CODEC_ID_SIPR) && track->codec_priv.data) { + const uint8_t *ptr = track->codec_priv.data; int flavor; - ffio_init_context(&b, track->codec_priv.data, - track->codec_priv.size, - 0, NULL, NULL, NULL, NULL); - avio_skip(&b, 22); - flavor = avio_rb16(&b); - track->audio.coded_framesize = avio_rb32(&b); - avio_skip(&b, 12); - track->audio.sub_packet_h = avio_rb16(&b); - track->audio.frame_size = avio_rb16(&b); - track->audio.sub_packet_size = avio_rb16(&b); + if (track->codec_priv.size < 46) + return AVERROR_INVALIDDATA; + ptr += 22; + flavor = bytestream_get_be16(&ptr); + track->audio.coded_framesize = bytestream_get_be32(&ptr); + ptr += 12; + track->audio.sub_packet_h = bytestream_get_be16(&ptr); + track->audio.frame_size = bytestream_get_be16(&ptr); + track->audio.sub_packet_size = bytestream_get_be16(&ptr); if (track->audio.coded_framesize <= 0 || track->audio.sub_packet_h <= 0 || track->audio.frame_size <= 0) |