summaryrefslogtreecommitdiff
path: root/libavformat/oggparsespeex.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-12 11:20:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-12 11:21:23 +0100
commita0f659b27575de81549e524d13457554b9095ac8 (patch)
treea84ba8c9ad4c15a580c58bcf45c5763b7a828d40 /libavformat/oggparsespeex.c
parent12fcc626d6ac5da5336f184c2c3f973cf00005f4 (diff)
oggspeexparse: fix array overread
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsespeex.c')
-rw-r--r--libavformat/oggparsespeex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 42480a3a27..63e6370482 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -58,6 +58,11 @@ static int speex_header(AVFormatContext *s, int idx) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_SPEEX;
+ if (os->psize < 68) {
+ av_log(s, AV_LOG_ERROR, "speex packet too small\n");
+ return AVERROR_INVALIDDATA;
+ }
+
st->codec->sample_rate = AV_RL32(p + 36);
st->codec->channels = AV_RL32(p + 48);
if (st->codec->channels < 1 || st->codec->channels > 2) {