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);