From patchwork Thu May 2 00:41:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 48464 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f91:b0:1af:7bf4:b644 with SMTP id mm17csp80365pzb; Wed, 1 May 2024 17:42:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYtSBs6FkS1LZB/Hu5ZGo6keWUUMewL6iUvtuedAwpa5YHYncLq+MqDdb3AR5iVrR8gjZZTGgF2BPzl8vo2/ekRuwVDI/sDrXlAw== X-Google-Smtp-Source: AGHT+IE0vf87AniO3Qw6m/sy0k7Mhspoq2PmO3AJ/Qn3Nx1y9YDJT9f81tgBrjjX42c5Y+hqsFor X-Received: by 2002:a05:600c:474d:b0:41a:bc88:b84 with SMTP id w13-20020a05600c474d00b0041abc880b84mr2675737wmo.1.1714610566591; Wed, 01 May 2024 17:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714610566; cv=none; d=google.com; s=arc-20160816; b=onNmzjm73mkR2XXPV5Zkbp1DC57OtGn4dxalNfFWlj2iA9p0SdNmWOnCF0lBVHC8ZR K+vorEqMwPIkzo4aXOIfuQ31tmiQ57nhg8UEhykjPPBvebGyQ30UsqnzlclWArrbRqxD USJMqRxxtrI8el+wiGAaqtF+NFmU4JHWnXCGnzIVzRlNZwS8XTU0WbhPdaVPYQHy45PF J+lFB4HcCGD+ngGj6aJNe5m6LTYC3kXA08wQpuszZ5K+HHrW+xLMGViwrwDvyaHcuYsv hxw4jx1zaY9gCGCqap8opMdwPvmloLEvuh44vTCHSFghHAxM2wWFSZfPIXTClh9bgego XQTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=gHgqAO0CgGYTUL81rQbdnAr0IUR6T9M6GVTOLY9FUYE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=VSDcbIJro2wU+w4Ar2yf0NVVGscbA8ohQJrtSLcHtZQYODiKhusA1rZWkvUQUMiYAK 7aHUJoDm5q1sZJfL69C+Q7pPjA79DMN9BmtK03jsXQSgfSljNCkaFX590zhQen2I9uQR xt861ONI7S0X8veZrtj0/SBTvpAxJBRxIyEtm5/qiquTGQ8myZb3ERu57Wlq/+pW/bOt uOnt5f7us1LtP4BHAIXsol5dWJOT+rzz9WtYcPIIBzld5PR71F7zYMukBXSpGjghNEWY bKmg5MnswWJItYo1nF35sJ4PT/tnk+dYDqzY7M22H1K4/KQfLkG1LIsEWSxZ/AZ+a5nO rVNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=p0UkiWcW; 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 y5-20020a056402134500b00572be1bb6f4si151580edw.573.2024.05.01.17.42.45; Wed, 01 May 2024 17:42:46 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=p0UkiWcW; 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 83F3368D77E; Thu, 2 May 2024 03:42:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDF2D68D771 for ; Thu, 2 May 2024 03:41:56 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 13AD840003 for ; Thu, 2 May 2024 00:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1714610516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2HBlkV3twx6zMIJzrcGXYulmt3659BriNT+tIDYe5dw=; b=p0UkiWcWSwFck7FvTQuBNMyMdk/iLhpUXYSsdvkcP+83hyEybzxD9IevBkMmiKx/XfTfm+ danF74xZIbcWSle5Prd9hR4Y8QaUMCJixPvFfBeZQrkDzYQzi+j8ynt3S9HuXOvTlK+7HK WatSzGrY18Upod4tGF+Ukj+7d1emAsMYf26ebZKcxzRnLMcZ1JuWOmcpZ7UYW857b2mCxM J+X6RyFPyA/ejW3pYWpdfGKHM2bld5pEHWIgvyZXPeTy7Pj/APuhKihgY5CKYR14R4ng1m 6hhZ+XsFiQZFiuSglRdAU/N6x5ohaWAXoArNeznO1JcnlHh8n11qvpuyDMchYw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 2 May 2024 02:41:48 +0200 Message-ID: <20240502004150.3627661-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240502004150.3627661-1-michael@niedermayer.cc> References: <20240502004150.3627661-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/7] avcodec/avs3_parser: Check the return value of init_get_bits8() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: FVEIQt64PGZ+ Fixes: CID1492867 Unchecked return value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/avs3_parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c index a819b5783d6..0f9076befe1 100644 --- a/libavcodec/avs3_parser.c +++ b/libavcodec/avs3_parser.c @@ -73,7 +73,9 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf, GetBitContext gb; int profile, ratecode, low_delay; - init_get_bits8(&gb, buf + 4, buf_size - 4); + int ret = init_get_bits8(&gb, buf + 4, buf_size - 4); + if (ret < 0) + return; s->key_frame = 1; s->pict_type = AV_PICTURE_TYPE_I;