diff options
author | Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> | 2017-01-01 20:27:50 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-26 00:34:12 +0100 |
commit | 41fc098a8612ba1af98ea0713c929a1f32f3ae87 (patch) | |
tree | ca5e83ddbcf89da06a747b3d1efe0df812fb7e85 | |
parent | 3442c20c4d380d232120ba5c41283ded0125b348 (diff) | |
download | ffmpeg-41fc098a8612ba1af98ea0713c929a1f32f3ae87.tar.gz |
libopenmpt: add missing avio_read return value check
This fixes heap-buffer-overflows in libopenmpt caused by interpreting
the negative size value as unsigned size_t.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 367cac7827870054ae3bd6d4517e7b13f4f3f72c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/libopenmpt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index e7091ef9fc..35fd28f5f4 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -82,6 +82,11 @@ static int read_header_openmpt(AVFormatContext *s) if (!buf) return AVERROR(ENOMEM); size = avio_read(s->pb, buf, size); + if (size < 0) { + av_log(s, AV_LOG_ERROR, "Reading input buffer failed.\n"); + av_freep(&buf); + return size; + } openmpt->module = openmpt_module_create_from_memory(buf, size, openmpt_logfunc, s, NULL); av_freep(&buf); |