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 837B24B544 for ; Fri, 7 Jun 2024 23:18:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 860B868D85E; Sat, 8 Jun 2024 02:18:12 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCA2868CDAE for ; Sat, 8 Jun 2024 02:18:05 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1AF1B60002 for ; Fri, 7 Jun 2024 23:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717802285; 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=EndNSM2gsGzaCKAFmYGjtwP8elHsf5yP5vOBuQx03os=; b=dfvxfOBK58H4+u1iV8bLCvagt+YNPjTfveLUaYhTfzYCt9Lwm9IimShYIGMHWk+QZbUW2N iJgH8/6GO9DjQcpRtQdrAlntIsyA58aqAxA5MpFOE85/yhjpk2zViSfYKJK54TOwHwE0cQ 3yxoyw0wjgdxxFTWkbrmdfnj5YE4k1E6D3xVsEaDxt0dnQL/KXiGA47CbsPTR1jvwEUyB+ d4O14QpsvhZdJH5XfI2VHrNaVP5TYBYlqDdGm4L1Jmiyc8SE/HnAopMlZw25bHqDeeG1gr jiV0mfSsI33dUPGIi355Ty4OkqB/5EG6Z3OCjc6IncgVEkb+Yl2tGsx2AcOsmA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 8 Jun 2024 01:18:01 +0200 Message-ID: <20240607231803.3017607-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607231803.3017607-1-michael@niedermayer.cc> References: <20240607231803.3017607-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly 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: Found while reviewing: CID1530313 Untrusted loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/rtmppkt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index bb7e6d20bc8..ec10c89fc8a 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -440,7 +440,6 @@ static int amf_tag_skip(GetByteContext *gb) { AMFDataType type; unsigned nb = -1; - int parse_key = 1; if (bytestream2_get_bytes_left(gb) < 1) return -1; @@ -465,13 +464,12 @@ static int amf_tag_skip(GetByteContext *gb) bytestream2_skip(gb, 10); return 0; case AMF_DATA_TYPE_ARRAY: - parse_key = 0; case AMF_DATA_TYPE_MIXEDARRAY: nb = bytestream2_get_be32(gb); case AMF_DATA_TYPE_OBJECT: - while (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY) { + while (type != AMF_DATA_TYPE_ARRAY || nb-- > 0) { int t; - if (parse_key) { + if (type != AMF_DATA_TYPE_ARRAY) { int size = bytestream2_get_be16(gb); if (!size) { bytestream2_get_byte(gb); -- 2.45.2 _______________________________________________ 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".