ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Tue 
Jan 26 17:41:28 2021 +0100| [cb316676112c01e8d66420908b6b3d06b3b498e3] | 
committer: Michael Niedermayer

avformat/flvdec: Check for avio_read() failure in amf_get_string()

Suggested-by: Anton Khirnov <an...@khirnov.net>
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb316676112c01e8d66420908b6b3d06b3b498e3
---

 libavformat/flvdec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8571a626ae..c1f02125bc 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';
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to