aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-16 20:36:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-06 14:41:41 +0200
commit32982e145aaced0e6763fa8f0c5412e1d634b2f9 (patch)
tree39b0706d15e5619d16cf701063afeffb44f0ade1
parent74c4d2bfd7bfaa86153751e922382e15f3e9a784 (diff)
downloadffmpeg-32982e145aaced0e6763fa8f0c5412e1d634b2f9.tar.gz
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>
-rw-r--r--tools/cws2fws.c6
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;