diff mbox series

[FFmpeg-devel,2/3] tools/cws2fws: Check read() for failure

Message ID 20210516193901.30853-2-michael@niedermayer.cc
State Accepted
Commit 0b3cdd7cc2c63969e144cc3eb39d0c61260509ee
Headers show
Series [FFmpeg-devel,1/3] avcodec/dpx: fix off by 1 in bits_per_color check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 16, 2021, 7:39 p.m. UTC
Fixes: CID1452579 Argument cannot be negative

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 tools/cws2fws.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Niedermayer July 2, 2021, 7:41 p.m. UTC | #1
On Sun, May 16, 2021 at 09:39:00PM +0200, Michael Niedermayer wrote:
> Fixes: CID1452579 Argument cannot be negative
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  tools/cws2fws.c | 6 ++++++
>  1 file changed, 6 insertions(+)

will apply

[...]
diff mbox series

Patch

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;