mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-10 22:47:32 +00: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>
This commit is contained in:
parent
2ef522c918
commit
cb31667611
@ -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)
|
static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
int length = avio_rb16(ioc);
|
int length = avio_rb16(ioc);
|
||||||
if (length >= buffsize) {
|
if (length >= buffsize) {
|
||||||
avio_skip(ioc, length);
|
avio_skip(ioc, length);
|
||||||
return -1;
|
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';
|
buffer[length] = '\0';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user