From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id 9FEF6467E6
	for <ffmpegdev@gitmailbox.com>; Sun, 18 Jun 2023 23:44:47 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E98968BF9B;
	Mon, 19 Jun 2023 02:44:01 +0300 (EEST)
Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com
 [209.85.167.178])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BAA2A68BF58
 for <ffmpeg-devel@ffmpeg.org>; Mon, 19 Jun 2023 02:43:54 +0300 (EEST)
Received: by mail-oi1-f178.google.com with SMTP id
 5614622812f47-39ca2539200so1969957b6e.1
 for <ffmpeg-devel@ffmpeg.org>; Sun, 18 Jun 2023 16:43:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1687131833; x=1689723833;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=TA8ylwkejxdWVhLpMtyU9C4CODHE4GQsdgQ7filMZHY=;
 b=O9b41ndQ7VlSyB55sbe861IutlDMHKBAqqmcojekqBs+w7I8Y7f7rsK75dCmJYVJYk
 YpPVG/g6pq0Sle0WAQ+EQrzmcnoJURBYnXtWgkTRDkJKFs3BX8FvsUHNym+BLC5Lh0WE
 UII0vVf8E6guzNDGHulAeOQEZ7rml7n+DRHpdG7znmvUBuIrmA1CUsn01QG9qVT8E9hr
 RB3mQitscas7JtvrcsHw1buhIbjsW37FmedXEhm4R1ySPuGfAakI+S3t3xVV0YfEz0ZU
 qBSZSNBZE0MCUlm2gHXNLuf+evQYhptu2iWUtEgEWEtU3G1xpWYqejEohor1ilYAVbfc
 Mv1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1687131833; x=1689723833;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=TA8ylwkejxdWVhLpMtyU9C4CODHE4GQsdgQ7filMZHY=;
 b=Y/wb91owVog893kyjBBug8JDVUebHv4BsXdNVGR543jLupaAD8Z+XaNJk6HVafKhpB
 KRvu6k51tmfn8kojjnbl/uhXqZpqmtrC14FPUx/3e4FANGSzYumRrPYSTbGMNACT6KhF
 QRoFwq2P0DmAMphnOTywOTAzvSZLTlv/p9t8ccNQr5/XO+nP+ADuKv5WCeVlgA8pBYYc
 ZtrkXChDg9CouFCLHB63Z6dhvmffHlD1naT2mx6N2TzShbBpuf8rL6ihdHQhM1spqJEr
 hDPi3YN5G7R1hUIcjOxFk2dDeVcFXK+suOlB8dpHlrMBCdEnBe1jj8ntqR1W1zs8JJw8
 /pAQ==
X-Gm-Message-State: AC+VfDwywGKxojgwVzcMfQ6/5ydRKs03EhNffUrP2wlXcW46kOOD8nDX
 CiaPAlrk5fHJs/Ec3lUtXyzX09IGUlY=
X-Google-Smtp-Source: ACHHUZ4nVo2YBlgd7Qb6ELXUkZeDtCdZmrCYZuX1BlZkS03LrbWhHUORxolIvV4o4+BGiPlAOtOIpQ==
X-Received: by 2002:aca:b9c6:0:b0:39c:7f78:ba6d with SMTP id
 j189-20020acab9c6000000b0039c7f78ba6dmr7755315oif.19.1687131833148; 
 Sun, 18 Jun 2023 16:43:53 -0700 (PDT)
Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar.
 [190.225.105.197]) by smtp.gmail.com with ESMTPSA id
 bk36-20020a0568081a2400b0039eb5f4543csm2069664oib.34.2023.06.18.16.43.51
 for <ffmpeg-devel@ffmpeg.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 18 Jun 2023 16:43:52 -0700 (PDT)
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Sun, 18 Jun 2023 20:43:32 -0300
Message-ID: <20230618234332.1370-7-jamrial@gmail.com>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20230617151848.1378-1-jamrial@gmail.com>
References: <20230617151848.1378-1-jamrial@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 17/17] avcodec/evc_ps: Check
 log2_sub_gop_length
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20230618234332.1370-7-jamrial@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

From: Michael Niedermayer <michael@niedermayer.cc>

Fixes: 1.70141e+38 is outside the range of representable values of type 'int'
Fixes: 59883/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-5557887217565696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/evc_ps.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/evc_ps.c b/libavcodec/evc_ps.c
index b8d7329b94..0b8cc81d49 100644
--- a/libavcodec/evc_ps.c
+++ b/libavcodec/evc_ps.c
@@ -229,6 +229,10 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size)
 
     if (!sps->sps_pocs_flag || !sps->sps_rpl_flag) {
         sps->log2_sub_gop_length = get_ue_golomb(&gb);
+        if (sps->log2_sub_gop_length > 5U) {
+            ret = AVERROR_INVALIDDATA;
+            goto fail;
+        }
         if (sps->log2_sub_gop_length == 0)
             sps->log2_ref_pic_gap_length = get_ue_golomb(&gb);
     }
@@ -288,6 +292,9 @@ int ff_evc_parse_sps(EVCParamSets *ps, const uint8_t *bs, int bs_size)
     ps->sps[sps_seq_parameter_set_id] = sps;
 
     return 0;
+fail:
+    av_free(sps);
+    return ret;
 }
 
 // @see ISO_IEC_23094-1 (7.3.2.2 SPS RBSP syntax)
-- 
2.41.0

_______________________________________________
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".