From patchwork Mon Apr 1 16:08:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 47692 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp833533pzb; Mon, 1 Apr 2024 09:08:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2SC7dguo1qpF4VAWVEv8ccoiY+wtVi7YCXPXzkRUOOw2YNGaXEyVOW9Ns+t9Lrp6g/nHmu4oxhFkdlKMMH5mw+p8HxXnLDDofKQ== X-Google-Smtp-Source: AGHT+IEy727SlwUIZO3q7WJ/czwYteXl+E2x7ZPME4sprmekpyuq8suxE9/6cRJonAtIXuBgD5Z5 X-Received: by 2002:a05:6402:40c4:b0:56d:cc5d:d750 with SMTP id z4-20020a05640240c400b0056dcc5dd750mr3066919edb.2.1711987726546; Mon, 01 Apr 2024 09:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711987726; cv=none; d=google.com; s=arc-20160816; b=XHDbsk9ZfrLmsq0QH94tcvCICnXAapDfAN0DzcPvKvol0CJs6xfU0zoZv2iTYJ6N+1 G32wS9efc90NjuV/zYGrFdPxBlNz5dC+3gnUcI4c2lfyB4ix6+c/xlN9aqaQx8ruKOU1 ++hvxL5NCZ9KzF7sdEVchqPwxtLwmPWC8k0HdmV3m69HQzLT28xH5RT1rXqjYogO/iO5 PYG48NifXiYfCfd1V1PsEY2OTnluANTSWyxehLcqtYEublwvzdiBLrCCI5W7hXfJFrM6 /LNdwgxdqT46GfOGktp/byepVsW2nph5TrUt/2Lv19/x40A7Y6OqduiUweOjXRgSxcK5 66ug== 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:dkim-signature :delivered-to; bh=/hbe9j3Mc4yXE9WkRdkR2fWwqzX1bBKMvQB46udK8G4=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=MCzupEVYUuSP/z4Lq8yAw6ofvWAwkts9rX+XydHsGOvGLTjmE9G7v/bKQ3tqR8ziIf LHxOEu5ZGASC6SsKrmC2Pdp1eRctKgHTU6i3HAJZXEk5OeWxpvta9rqFlY7MyTyunLou 2OcU8knEYYdmIe/MdTw4oAQhCrCZPoAwvmRLuWUQroK5g74f6mxpIBdLPZe6I4DT1wvG EtCE10Zk2ZkZYF0snd4LC3LwZh/dEjwt7CelHTus4I2iSD0Pb0szrV5SW58eQ1po+Bf+ aTT8iq/RiDVc8qHJLlfS0rw7+BNXZh0wMzGqJytJc6UasiYUgoox4NqHsSK6w+KHup7P dUkg==; 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="hWIh8A/K"; 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 h15-20020a05640250cf00b0056c4e641eecsi4832970edb.219.2024.04.01.09.08.45; Mon, 01 Apr 2024 09:08: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="hWIh8A/K"; 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 B96B168CAE2; Mon, 1 Apr 2024 19:08:42 +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 9B4FB68CAE2 for ; Mon, 1 Apr 2024 19:08:36 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EB8C440003 for ; Mon, 1 Apr 2024 16:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711987716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=UCvJDWPNkFhGw/xUn2rHgiCnI2/9d7P24WD7pHEdLCg=; b=hWIh8A/KFYf1RWCbuAhJB9m3mJWSowIBpmkHOV4F8372DJAJTrew4hYcg0QCh7C+Q+Ztgl IL+mt6dFciz6yLnblaeuAA5JKTqCVZLUpv26YkI5MbLhnhVMizimNEJciaN/qFW/bFyTWe J1m634i329I+olc6zXZwjWCDG//QqQP0PoJaqA9tUfTdZEDdTtf+XCM23QutARggbsBCg0 ohlCeFj4r55LBmCdZJsBN1dYNZoojSVdKFp/Y/ZuoTFmzDB7qeE3IDmKvqWiDwugQMpQGA /yDkCbj5BfQlDB14WizLIzFe32r2If0mQfcBNC98fxukWjkYQaq/9dllGkDlnQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 1 Apr 2024 18:08:35 +0200 Message-Id: <20240401160835.19523-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH] avformat/mxfdec: Check that edit_unit_byte_count is not negative 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: qXa3+oiEK0o+ Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index e484db052ef..37446963369 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1245,9 +1245,13 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFIndexTableSegment *segment = arg; + int tmp; switch(tag) { case 0x3F05: - segment->edit_unit_byte_count = avio_rb32(pb); + tmp = avio_rb32(pb); + if (tmp < 0) + return AVERROR_INVALIDDATA; + segment->edit_unit_byte_count = tmp; av_log(NULL, AV_LOG_TRACE, "EditUnitByteCount %d\n", segment->edit_unit_byte_count); break; case 0x3F06: