aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-26 17:41:28 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:21 +0100
commit146e353d9c3dec7a7db26c17245f6886d7d1dcce (patch)
treef758c809a214463c4a011daf0ca816e962aab0e0
parentd85607f30a00254bace841b68c5e778b3da3ef01 (diff)
downloadffmpeg-146e353d9c3dec7a7db26c17245f6886d7d1dcce.tar.gz
avformat/flvdec: Check for avio_read() failure in amf_get_string()
Suggested-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit cb316676112c01e8d66420908b6b3d06b3b498e3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/flvdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 6e07b59676..d3ff893edb 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -384,13 +384,18 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize)
{
+ int ret;
int length = avio_rb16(ioc);
if (length >= buffsize) {
avio_skip(ioc, length);
return -1;
}
- avio_read(ioc, buffer, length);
+ ret = avio_read(ioc, buffer, length);
+ if (ret < 0)
+ return ret;
+ if (ret < length)
+ return AVERROR_INVALIDDATA;
buffer[length] = '\0';