Browse Source

avformat/tty: make probing strict for first 8 bytes

tags/n4.3
Paul B Mahol 6 years ago
parent
commit
9216ad2e46
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      libavformat/tty.c

+ 7
- 1
libavformat/tty.c View File

@@ -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) *


Loading…
Cancel
Save