From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E290042851 for ; Sat, 8 Jan 2022 12:27:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA0ED68A993; Sat, 8 Jan 2022 14:27:45 +0200 (EET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6998068996A for ; Sat, 8 Jan 2022 14:27:38 +0200 (EET) Received: by mail-pl1-f179.google.com with SMTP id s15so7048074plg.12 for ; Sat, 08 Jan 2022 04:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=Y16aLT9huUlMgg89Fmxjjbny6/V4N5YpM1qLT1lrajU=; b=Y/FL9a+TAOncfkE+ArYmiDXUUX+QCRGnjYVmRPoWJqi/aWeXupJHVJIDNKgIVU9yFB fJc0z3W25gOaDM/i6a3z0qs+yEFmBp7Ao3ZQQvLVWBOpXubsBuxcUyv9/SZRAgSjEl9o HYBNUGGr2t8WAdCndbbu9Z+5igzeHHeOOohXIsyS15fpG6k4jGNRuiBJUtk+6RB9KnOx ErcWosoR++G0ldqpPBuRZTJGsITJwCQ5dhtDixbarDG/PXD8aTM62ygRimDOracXwWm8 ZYMxh/BX0V0p/Gb18BMrJX3E/4dKqXyd73VLRKO/7VRWFziafv9UH4UxhU4863I/k8yT qOrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=Y16aLT9huUlMgg89Fmxjjbny6/V4N5YpM1qLT1lrajU=; b=UBnD0o14H5pC7TuC6q87c/IMPF4eifW09y6cj+FDlpCylNIu3iHN8SY4V2ZT+SKlna Yo5jqg3Z//xPC1Qd3Vx8g8KyKZIqbvBb9LDZYYhgFta8bXrDYkJEk4hCeBnA8MpAwa+j UQ0mZR2ONkuPdmEIeIajhIXdEDALY0MDiG7ZUPIPQ5ncdzDylUkUHmS4UdftQR2bUxfl sck+NpyptcGGQYu7cON+/Ve+Cpx4FrlqjRS5tVTYTkd7xAJxR+zWmjXXWk3C1uSoZYrm tPdO23odIxbiG6reSU3FUDEjCEmxSTRRDehrRLmgFBEqBs0hxv2AV8P+T6u9w1yHfYM3 uZCA== X-Gm-Message-State: AOAM531p6+wyb8el7RmidItKXlB5LBsAob3KtUm0Gq5NOkQLOZU0V9Wy Lk9LkyUcj3J2EnEM7IRgaLnvaczW568= X-Google-Smtp-Source: ABdhPJxPwXW6H+OmCDq1JdJiaxaOGCLSY6rvyrFxMa9kj4T6Wr1emYP3Zg95+nevqJQ4DQt+jq82kA== X-Received: by 2002:a17:90b:4a09:: with SMTP id kk9mr20333051pjb.230.1641644855564; Sat, 08 Jan 2022 04:27:35 -0800 (PST) Received: from gmail.com ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id l9sm1534966pgc.20.2022.01.08.04.27.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Jan 2022 04:27:35 -0800 (PST) Date: Sat, 8 Jan 2022 20:27:32 +0800 From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Message-ID: <20220108122732.GA31369@gmail.com> Mail-Followup-To: ffmpeg-devel@ffmpeg.org References: <20220107165111.9929-1-michael@niedermayer.cc> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220107165111.9929-1-michael@niedermayer.cc> Subject: Re: [FFmpeg-devel] [PATCH] avformat/rawvideodec: check packet size X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, Jan 07, 2022 at 05:51:11PM +0100, Michael Niedermayer wrote: > Fixes: division by zero > Fixes: integer overflow > Fixes: 43347/clusterfuzz-testcase-minimized-ffmpeg_dem_V210X_fuzzer-5846911637127168 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/rawvideodec.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c > index 68547fc50ff..387c4ba80f5 100644 > --- a/libavformat/rawvideodec.c > +++ b/libavformat/rawvideodec.c > @@ -42,6 +42,7 @@ static int rawvideo_read_header(AVFormatContext *ctx) > enum AVPixelFormat pix_fmt; > AVStream *st; > int packet_size; > + int ret; > > st = avformat_new_stream(ctx, NULL); > if (!st) > @@ -62,6 +63,10 @@ static int rawvideo_read_header(AVFormatContext *ctx) > > avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num); > > + ret = av_image_check_size(s->width, s->height, 0, ctx); > + if (ret < 0) > + return ret; > + > st->codecpar->width = s->width; > st->codecpar->height = s->height; > > @@ -100,6 +105,8 @@ static int rawvideo_read_header(AVFormatContext *ctx) > if (packet_size < 0) > return packet_size; > } > + if (packet_size == 0) > + return AVERROR(EINVAL); > > st->codecpar->format = pix_fmt; > ctx->packet_size = packet_size; > -- > 2.17.1 > LGTM > _______________________________________________ > 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". -- Thanks, Limin Wang _______________________________________________ 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".