1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

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>
This commit is contained in:
Michael Niedermayer 2021-01-26 17:41:28 +01:00
parent abb8a37bf8
commit f551bcd6d6

View File

@ -357,13 +357,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';