From 367cac7827870054ae3bd6d4517e7b13f4f3f72c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sun, 1 Jan 2017 20:27:50 +0100 Subject: [PATCH] libopenmpt: add missing avio_read return value check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes heap-buffer-overflows in libopenmpt caused by interpreting the negative size value as unsigned size_t. Signed-off-by: Andreas Cadhalpun Reviewed-by: Jörn Heusipp Signed-off-by: Michael Niedermayer --- libavformat/libopenmpt.c | 5 +++++ 1 file changed, 5 insertions(+) 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);