avformat/tty: Fix division by 0 in probe

Fixes: division by zero
Fixes: 20436/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5763229752229888
Fixes: 20503/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4841641154445312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-02-05 22:22:30 +01:00
parent c9c958051c
commit 87d54a6239

View File

@ -53,6 +53,9 @@ static int read_probe(const AVProbeData *p)
{
int cnt = 0;
if (!p->buf_size)
return 0;
for (int i = 0; i < p->buf_size; i++)
cnt += !!isansicode(p->buf[i]);