diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-05-16 21:36:46 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-11 22:23:49 +0300 |
commit | 375aa8f5f85c6b905e556a197e38a5edb2f59f71 (patch) | |
tree | fc6291f213e80e266e72539ec3fb8dbf3e70cefb /tools | |
parent | 3ecb97e45bff369ac604a4025a3f53cee484c0a8 (diff) |
tools/cws2fws: Check read() for failure
Fixes: CID1452579 Argument cannot be negative
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0b3cdd7cc2c63969e144cc3eb39d0c61260509ee)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cws2fws.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |