[FFmpeg-cvslog] fftools/ffmpeg: Check read() for failure

Michael Niedermayer git at videolan.org
Tue Jul 2 23:00:40 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun 30 22:23:06 2024 +0200| [34fd247c3bf06418c1eaafacf0d6052e3bbe4f5e] | committer: Michael Niedermayer

fftools/ffmpeg: Check read() for failure

Fixes: CID1591932 Ignoring number of bytes read

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 fftools/ffmpeg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 88ce3007e8..8674c4d250 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;
         }



More information about the ffmpeg-cvslog mailing list