[FFmpeg-devel] [PATCH 08/11] fftools/ffmpeg: Check read() for failure

Michael Niedermayer michael at niedermayer.cc
Mon Jul 1 02:12:47 EEST 2024


Fixes: CID1591932 Ignoring number of bytes read
Untested, this needs a windows machine

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 fftools/ffmpeg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 88ce3007e83..8674c4d2506 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -285,8 +285,9 @@ static int read_key(void)
         }
         //Read it
         if(nchars != 0) {
-            read(0, &ch, 1);
-            return ch;
+            if (read(0, &ch, 1) == 1)
+                return ch;
+            return 0;
         }else{
             return -1;
         }
-- 
2.45.2



More information about the ffmpeg-devel mailing list