[FFmpeg-cvslog] avformat/tty: make probing strict for first 8 bytes
Paul B Mahol
git at videolan.org
Mon Feb 10 16:07:49 EET 2020
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Feb 2 13:51:49 2020 +0100| [9216ad2e46ad09a8d6810d52fcd8714ba3e39e44] | committer: Paul B Mahol
avformat/tty: make probing strict for first 8 bytes
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9216ad2e46ad09a8d6810d52fcd8714ba3e39e44
---
libavformat/tty.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 854a23c500..f889121e26 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -56,7 +56,13 @@ static int read_probe(const AVProbeData *p)
if (!p->buf_size)
return 0;
- for (int i = 0; i < p->buf_size; i++)
+ for (int i = 0; i < 8 && i < p->buf_size; i++)
+ cnt += !!isansicode(p->buf[i]);
+
+ if (cnt != 8)
+ return 0;
+
+ for (int i = 8; i < p->buf_size; i++)
cnt += !!isansicode(p->buf[i]);
return (cnt * 100LL / p->buf_size) * (cnt > 400) *
More information about the ffmpeg-cvslog
mailing list