[FFmpeg-cvslog] libavformat/aviobuf: Forward error from avio_read in ffio_read_size()

Michael Niedermayer git at videolan.org
Thu Nov 5 01:22:47 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Oct 31 10:29:56 2020 +0100| [66ca6d0fe8baf1453caaa5761fc0572665a75e78] | committer: Michael Niedermayer

libavformat/aviobuf: Forward error from avio_read in ffio_read_size()

Suggested-by: Andreas Rheinhardt
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/aviobuf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 80a5a565a4..82c20cab52 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -686,9 +686,11 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
 int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
 {
     int ret = avio_read(s, buf, size);
-    if (ret != size)
-        return AVERROR_INVALIDDATA;
-    return ret;
+    if (ret == size)
+        return ret;
+    if (ret < 0 && ret != AVERROR_EOF)
+        return ret;
+    return AVERROR_INVALIDDATA;
 }
 
 int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data)



More information about the ffmpeg-cvslog mailing list