[FFmpeg-cvslog] tools/cws2fws: Check read() for failure

Michael Niedermayer git at videolan.org
Wed Sep 8 22:42:55 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun May 16 20:36:46 2021 +0200| [9f97a023d63f1d6027a4ebb6d5cd71f127370e1e] | committer: Michael Niedermayer

tools/cws2fws: Check read() for failure

Fixes: CID1452579 Argument cannot be negative

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 0b3cdd7cc2c63969e144cc3eb39d0c61260509ee)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 tools/cws2fws.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/cws2fws.c b/tools/cws2fws.c
index 7046b69957..9ce321fe20 100644
--- a/tools/cws2fws.c
+++ b/tools/cws2fws.c
@@ -89,6 +89,12 @@ int main(int argc, char *argv[])
     for (i = 0; i < comp_len - 8;) {
         int ret, len = read(fd_in, &buf_in, 1024);
 
+        if (len == -1) {
+            printf("read failure\n");
+            inflateEnd(&zstream);
+            goto out;
+        }
+
         dbgprintf("read %d bytes\n", len);
 
         last_out = zstream.total_out;



More information about the ffmpeg-cvslog mailing list