aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-06-30 22:23:06 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-07-02 21:57:17 +0200
commit34fd247c3bf06418c1eaafacf0d6052e3bbe4f5e (patch)
tree69d0413c40e57469d34a392c1516b4ae5a48d578
parent6398242bb2b9bfdef9d7fd4614a3518ffb1fefec (diff)
downloadffmpeg-34fd247c3bf06418c1eaafacf0d6052e3bbe4f5e.tar.gz
fftools/ffmpeg: Check read() for failure
Fixes: CID1591932 Ignoring number of bytes read Sponsored-by: Sovereign Tech Fund Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--fftools/ffmpeg.c5
1 files 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;
}