diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-16 12:38:41 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-16 12:38:41 +0100 |
commit | 5c7e9e16c961f1f7258734426afac3cee4349580 (patch) | |
tree | 20ea7bec723ef262bffb8f2447adcc1dc3d98069 /libavformat/rtpdec_mpeg4.c | |
parent | 0e79fe37e5c5500db2e65ce6b7ea0bbdb3f24665 (diff) | |
parent | e034cc6c60c77dce390b1ac31141b1862bdf8999 (diff) | |
download | ffmpeg-5c7e9e16c961f1f7258734426afac3cee4349580.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
lavc: Move vector_fmul_window to AVFloatDSPContext
rtpdec_mpeg4: Check the remaining amount of data before reading
Conflicts:
libavcodec/dsputil.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpdec_mpeg4.c')
-rw-r--r-- | libavformat/rtpdec_mpeg4.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index 737d993b07..1f0a0b051a 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -109,11 +109,14 @@ static int parse_fmtp_config(AVCodecContext *codec, char *value) return 0; } -static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf) +static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len) { int au_headers_length, au_header_size, i; GetBitContext getbitcontext; + if (len < 2) + return AVERROR_INVALIDDATA; + /* decode the first 2 bytes where the AUHeader sections are stored length in bits */ au_headers_length = AV_RB16(buf); @@ -125,6 +128,10 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf) /* skip AU headers length section (2 bytes) */ buf += 2; + len -= 2; + + if (len < data->au_headers_length_bytes) + return AVERROR_INVALIDDATA; init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8); @@ -165,7 +172,7 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, int flags) { int ret; - if (rtp_parse_mp4_au(data, buf)) + if (rtp_parse_mp4_au(data, buf, len)) return -1; buf += data->au_headers_length_bytes + 2; @@ -173,6 +180,8 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define one au_header */ + if (len < data->au_headers[0].size) + return AVERROR_INVALIDDATA; if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0) return ret; memcpy(pkt->data, buf, data->au_headers[0].size); |