From 2dc91884652aa586951026dc2d518b9b6957577a Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Thu, 12 Feb 2009 02:17:16 +0000
Subject: [PATCH] return error if read failed

Originally committed as revision 17173 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/ffmdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 6f96c719ab2..e8e1891b4a5 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -30,7 +30,8 @@ int64_t ffm_read_write_index(int fd)
     uint8_t buf[8];
 
     lseek(fd, 8, SEEK_SET);
-    read(fd, buf, 8);
+    if (read(fd, buf, 8) != 8)
+        return AVERROR(EIO);
     return AV_RB64(buf);
 }
 
-- 
GitLab