summaryrefslogtreecommitdiff
path: root/libavformat/riffdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-06-28 17:32:40 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-06-28 17:32:40 +0200
commit1b4c468477f3b8d372da8ef4e5405539ad9c1501 (patch)
tree6d9b52535b68e47fd8933f3843c9259d019cd564 /libavformat/riffdec.c
parent5bdfc17189e4ea63c6b46b6d5256852fcb409d68 (diff)
riff: Validate the wav header size before trying to parse it
Diffstat (limited to 'libavformat/riffdec.c')
-rw-r--r--libavformat/riffdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 74f93acedf..2c43afc27c 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -79,6 +79,9 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
{
int id;
+ if (size < 14)
+ return AVERROR_INVALIDDATA;
+
id = avio_rl16(pb);
codec->codec_type = AVMEDIA_TYPE_AUDIO;
codec->channels = avio_rl16(pb);