diff mbox series

[FFmpeg-devel,3/5] avformat/tty: Fix division by 0 in probe

Message ID 20200209191424.19041-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avcodec/midivid: Check vector index
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 9, 2020, 7:14 p.m. UTC
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
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/tty.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol Feb. 9, 2020, 7:28 p.m. UTC | #1
ok

On 2/9/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 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
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/tty.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavformat/tty.c b/libavformat/tty.c
> index 60f7e9f87e..854a23c500 100644
> --- a/libavformat/tty.c
> +++ b/libavformat/tty.c
> @@ -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]);
>
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Feb. 9, 2020, 8:20 p.m. UTC | #2
On Sun, Feb 09, 2020 at 08:28:44PM +0100, Paul B Mahol wrote:
> ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/tty.c b/libavformat/tty.c
index 60f7e9f87e..854a23c500 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -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]);