From patchwork Tue Jan 24 23:42:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40103 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp743797pzj; Tue, 24 Jan 2023 15:43:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQNv8Lc6pLGifMA4h0oWYRgmFvNm9+h5yTIXqk1YizU+8F8GS8rBOSxus1E5IFPyR60pEQ X-Received: by 2002:a17:907:8b8a:b0:82e:a57b:cc9b with SMTP id tb10-20020a1709078b8a00b0082ea57bcc9bmr50840548ejc.24.1674603789075; Tue, 24 Jan 2023 15:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674603789; cv=none; d=google.com; s=arc-20160816; b=nSPE3eZ+XorIWat9ut4pE/8ho2DNyvOj0bUMQBgcBFVkTj21SAK6kfJVAOo774uU81 4zPYS6tLYQhMDNRRIr5Re12w/CLbY2vlv3AAQmsfobfj+i4m01tmd7ZfQ/CQBPbRNqE6 i3it/svj94x6vfBQAL+gafMwln2QVUPa96UrXKe/BRncphxYh+Ff9l3x3WlNvC4f0L4N N2kEK/xay37GYVmEirKbYbvAxLFdTjk2uNbr5uo8gjJerV9OFeRSvQu77aUT2Qc/y3mW 5/AewwnuByKBC0Ls2sipQWqoM6ryMBlFy5hj5H1xXrRXMrlPLys8HA9GgCvhYW0yzjpN FXew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=8QvJFtFijBKRoFYHsFvyyYLWH2hLlV/1xaIIEJue7qs=; b=D942aC2tEOL7KQTHy08eO5coZxN98M/rWu/HPaBqy1QK/Fh5SK4BDUp3I6E+8sD/UB jN5WcLAL7ksE5+NIk/e2ty8uz/4qYLp04dvYJwhW+sBNHrt+2khaJnUro4bRerwXNb7X s/Sy7bsfCLFh/mcGrA9hVHA/+el2rJ2G781x4hyyBcMJSCBrpYMCvBpvd5KaYj4h+Xf9 NCfeqcv5zL33zXC933jt8eAFseMsMFUvOCKR2VJxoHobxc3ZpbNHIp1c1lYnpYUTlfXc 0NRRfx4nbpLukHrAkHBWV+ZWyOKNPQ1Kooq3orz+GYAtn6hVvJbMhf4pUL3u4DroGmr1 EOKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 25-20020a170906225900b00877a6da8f57si3867458ejr.747.2023.01.24.15.43.08; Tue, 24 Jan 2023 15:43:09 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10FBB68BE4F; Wed, 25 Jan 2023 01:43:04 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BFE8368BD2B for ; Wed, 25 Jan 2023 01:42:56 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id CB975240004 for ; Tue, 24 Jan 2023 23:42:55 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 25 Jan 2023 00:42:53 +0100 Message-Id: <20230124234254.30008-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ST6pgibiZAxF framebuf is only allocated when the new width/height are larger than the old but nothing sets the old so its always allocated. Use av_fast_mallocz() instead. Fixes: Timeout Fixes: 55094/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5116909932904448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/g2meet.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 761fd22fc3..7363c2212d 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -145,7 +145,8 @@ typedef struct G2MContext { int got_header; uint8_t *framebuf; - int framebuf_stride, old_width, old_height; + int framebuf_stride; + unsigned int framebuf_allocated; uint8_t *synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base; int tile_stride, epic_buf_stride, old_tile_w, old_tile_h; @@ -1160,14 +1161,13 @@ static int g2m_init_buffers(G2MContext *c) { int aligned_height; - if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) { - c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3; - aligned_height = c->height + 15; - av_free(c->framebuf); - c->framebuf = av_calloc(c->framebuf_stride, aligned_height); - if (!c->framebuf) - return AVERROR(ENOMEM); - } + c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3; + aligned_height = c->height + 15; + + av_fast_mallocz(&c->framebuf, &c->framebuf_allocated, c->framebuf_stride * aligned_height); + if (!c->framebuf) + return AVERROR(ENOMEM); + if (!c->synth_tile || !c->jpeg_tile || (c->compression == 2 && !c->epic_buf_base) || c->old_tile_w < c->tile_width || @@ -1617,6 +1617,7 @@ static av_cold int g2m_decode_end(AVCodecContext *avctx) av_freep(&c->jpeg_tile); av_freep(&c->cursor); av_freep(&c->framebuf); + c->framebuf_allocated = 0; return 0; } From patchwork Tue Jan 24 23:42:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40104 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp743867pzj; Tue, 24 Jan 2023 15:43:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXvncYW0tN+m5TcuMFi5TacJBCVHz96EOiv2LFkBj9ZuYi9+l+gei5MDtib1nY/zBRNpgbwP X-Received: by 2002:a50:ff17:0:b0:499:d208:e8f4 with SMTP id a23-20020a50ff17000000b00499d208e8f4mr31292171edu.19.1674603799886; Tue, 24 Jan 2023 15:43:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674603799; cv=none; d=google.com; s=arc-20160816; b=j4C/CEj38fHQ1Buuowe6PeoQlui//ynaYCfgMqk2ypQpVks23iOL9gTEqiDY+B1zvk WCAv5ervqA7cNdaPR9KqJdYomZfVEZZIX8RuyMhgzuhYMl+unwA1pd9i4ACm1EcIX9wm fYxc+fHZ3iLFMUQE4IIqEj8p0TFzRI9pnRqeafiqdOYrtJylpc1/yd8odDiwuwhOCKkg lrnI0vOvK0vocBYeBKuBFzxkwI/dSavC0QBhj9yDI5IaIU4aQxgLJ1SWpM4/MVQdEvLl TrPrIcnFChd3vm5fx50xuZ+jPW4Uqu2nThSsP7d5XF8zhCFSn/F9dFJiIj2s6YIKa+m8 68kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=at4YGMQj2TV6JTuqMg7rEkcfmpo35/oG7z6abq40vvg=; b=bEElGu3822SSXZZT0qch+tcWHW+WXWxN9szl+zZPLzIAPQykvYslYKWMwOehYIDuGa JYZj3DnV/5ujTwQqKg59KpdpotBYxgigL+ETplon4xpVNqayPvqwNXAY3qyvuBfwpP8a TNcj/lgb3/yR6PNcp+Jh5zGAjMln0FKfbz7XDWur2qp9hSiixVbGA1wruE0uFNBE2pWw tTAlnrIQeg+TR5ocFD8ezwXkgHcEuW9W/i8HfiaLt/yWPeYgho1sAsdSGqu6iYgI7KKa xm5jX/LePXKrJ4RsQgXIL9oKzlW8lZ26sxcLPJTr0haas9KPO8dlvpZbrixfPqw5TDeb Ax0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s15-20020aa7d78f000000b0049e5332b5e7si4475710edq.46.2023.01.24.15.43.19; Tue, 24 Jan 2023 15:43:19 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3391E68BE78; Wed, 25 Jan 2023 01:43:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A1C568BD2B for ; Wed, 25 Jan 2023 01:42:57 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id C38E6240003 for ; Tue, 24 Jan 2023 23:42:56 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 25 Jan 2023 00:42:54 +0100 Message-Id: <20230124234254.30008-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230124234254.30008-1-michael@niedermayer.cc> References: <20230124234254.30008-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for EXR 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hvwHpM41fMHZ Fixes: Timeout Fixes: 55106/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5052199338377216 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index a20345db5c..0d532afea9 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -226,6 +226,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_DVB_SUBTITLE: av_dict_set_int(&opts, "compute_clut", -2, 0); break; case AV_CODEC_ID_DXA: maxpixels /= 32; break; case AV_CODEC_ID_DXV: maxpixels /= 32; break; + case AV_CODEC_ID_EXR: maxpixels /= 1024; break; case AV_CODEC_ID_FFV1: maxpixels /= 32; break; case AV_CODEC_ID_FFWAVESYNTH: maxsamples /= 16384; break; case AV_CODEC_ID_FLAC: maxsamples /= 1024; break;