From patchwork Sat May 7 09:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 34701 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2088365pzb; Sat, 7 May 2022 02:37:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+1PCfsrBs0d/sOAU0k6ULtdvSGS8F9bDIhGOW2F58Zi5nDxfCEW+X/kWjzxYQwU6l5Woq X-Received: by 2002:a05:6402:5286:b0:425:f0fb:5d23 with SMTP id en6-20020a056402528600b00425f0fb5d23mr7689051edb.243.1651916220743; Sat, 07 May 2022 02:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651916220; cv=none; d=google.com; s=arc-20160816; b=ZrCeXRJgb5y1H7rZMDWgOkvVqNZDMW9wG41+PJMH6N2eb0A1BSj+JXsADcHX+b1T0x y/RbbCAFhcHRLf/9tz9WVaEAH2VHJA+Ha+SkgryXdtGksdyRX3FHRfE4GVgy7nt96cAQ WFEljp+LUkHtgX2AaDp8CK/Pb3nUqEiznuaekANKuyy5kFUx6KHk2tygdp9pzJyXY763 CYtGBT/QDUEEvMihDJprr6XQjz5i3PwgdISDPrpe5HumBAkVyrfwjh5L1YIGgsH9HFU7 zK/FMw7Q7kvm++D+43LDs7oRxwR06CkQ2VQ35A/OesZRnlO7B/Mv94ryg8NTAvBUAa87 wPyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:fcc:date:from:references :in-reply-to:message-id:dkim-signature:delivered-to; bh=QiiKxsAjP0Jim5STwPKzlquRw6chlkPRBT1FfZ1XkiM=; b=rGTtqYKzA3iYAqVctUyGMj7/mfH+uoFIigzqgRCNuY1yC10jVItjLvdoqSP5kZ4CAr 7CHp8yCd615ZeGp4Ku4EwPGMnZMtijkA//rLRz1/boxmQdTIl21coWk4iJR39WCUAGM7 HAJX2RzZ/MU5cVU6eyXAyeodnB614X8dDJH5g3O/4pUBFHN+uzgZxk6y/+UNU62dKklo aa43qgRhJFCe0I63EK9VLGJL7LD0Mk9JqsHQIYVhAKFvUugWatNgzXqW4RrD4YXl0h/0 H0LeDKvk4SX76uXIOvlVnVAbeLAx1MjW462frR/wLjeoVtXfpVDeHrNxFY3cxzFLGB8O MYJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=LUBZaLPy; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w10-20020a056402128a00b00425e4f457d2si5991301edv.394.2022.05.07.02.36.59; Sat, 07 May 2022 02:37:00 -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=@gmail.com header.s=20210112 header.b=LUBZaLPy; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01E5968B356; Sat, 7 May 2022 12:36:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11CB968B140 for ; Sat, 7 May 2022 12:36:49 +0300 (EEST) Received: by mail-pg1-f176.google.com with SMTP id r192so3842559pgr.6 for ; Sat, 07 May 2022 02:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=YzkFvcZBzkwEwPk8AvdafTguSWT+feA+9VzX9BnW9Vc=; b=LUBZaLPy64STGeTOIX6xbNxGGlln8THtDE4Iua0jFjZ7GIpSVks4b6osSsYZXmHyfM GIp8dWvP+yYngE0ktPYG9bkB7Sv758ovmcVGmLtyatYH1nwd8NdPYjIRvp3e2iLvTw5g vFDYoiPF4UIsoxvcaOYII3T2T0CKYW5llA2mPg+pfdEifF1SdPDeDsBbnIur2ZEA21x0 dui2eOG1ZOODBniZzVUIbW6YcPIfbqE/KucbNIFhhJd/SgDsGMoEjfxKjCcqCGEGi0PM OYG3jn6iaPmz/Km2Fcf9XPZPkR/ECMSpsDpGfOF55mwgJUx4HjXaeU4OXp904wgp1p7J FYeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=YzkFvcZBzkwEwPk8AvdafTguSWT+feA+9VzX9BnW9Vc=; b=V5Pq/LaOlUCuSXyrWdK2ybrpbYw7A+AhTZsstzcZTpeHFmth/mMbZgtLrell0nJggv v6Nl37XMisf+7LzHSdGp4o8sVnxy4bOgk3JTfu3RTLElhpD+/eXympL3uFxiNdqaDv2X ieuJywxgMdhSDxq8UWCjP10pSKJb9/ZiE2ogH1ZivL1YifxLBOotVyNwFUssg92lMB1Z zOIGwvy3s0vFsb+zdRjNfqnIRwwoDBN8RCMIuyXJmfq+rVd/gxZWNclPHFrYRIrGem2g 3LfXl3OjRLGVY05E+yVpzZ6h65Nk5DscP/lAlsSza2MFu1I5/KLlVbQBZcuga5zhBlRr xVrw== X-Gm-Message-State: AOAM531lyjG2Gm78ejttuLn9KIZnOhGYsQEpnz5ui4V0csgh3Eax9WUi g4EoH3R2hur3bdUN95Lzl56bTqBDeIb1nw== X-Received: by 2002:a63:653:0:b0:3c6:3a11:c1a9 with SMTP id 80-20020a630653000000b003c63a11c1a9mr6068278pgg.440.1651916205687; Sat, 07 May 2022 02:36:45 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id g5-20020a635205000000b003c14af5060esm4953140pgb.38.2022.05.07.02.36.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 May 2022 02:36:45 -0700 (PDT) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Sat, 07 May 2022 09:36:33 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 00/11] libavformat/asf: fix handling of byte array length values 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 Cc: softworkz Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Dqgi7O63G8Nn The spec allows attachment sizes of up to UINT32_MAX while we can handle only sizes up to INT32_MAX (in downstream code) The debug.assert in get_tag didn't really address this, and truncating the value_len in calling methods cannot be used because the length value is required in order to continue parsing. This adds a check with log message in ff_asf_handle_byte_array to handle those (rare) cases. v2: Rebased & PING softworkz (11): libavformat/asf: fix handling of byte array length values libavformat/asfdec: fix get_value return type and add checks for libavformat/asfdec: fix type of value_len libavformat/asfdec: fixing get_tag libavformat/asfdec: implement parsing of GUID values libavformat/asfdec: remove unused parameters libavformat/asfdec: fix macro definition and use libavformat/asfdec: remove variable redefinition in inner scope libavformat/asfdec: ensure variables are initialized libavformat/asfdec: fix parameter type in asf_read_stream_propertie() libavformat/asfdec: fix variable types and add checks for unsupported values libavformat/asf.c | 12 +- libavformat/asf.h | 2 +- libavformat/asfdec_f.c | 349 ++++++++++++++++++++++++++--------------- 3 files changed, 232 insertions(+), 131 deletions(-) base-commit: f3b7ba21ba49b32b4476a8c7c5a9bcdad15e3943 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-12%2Fsoftworkz%2Fmaster-upstream_asf_4-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-12/softworkz/master-upstream_asf_4-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/12 Range-diff vs v1: 1: 1e8c0fa058 = 1: 0056a93a34 libavformat/asf: fix handling of byte array length values 2: b5be0046e9 = 2: a35b7c87d4 libavformat/asfdec: fix get_value return type and add checks for 3: c8119dad11 = 3: b8039dc4cf libavformat/asfdec: fix type of value_len 4: 3528d46886 = 4: 6e19df6e89 libavformat/asfdec: fixing get_tag 5: dc5a56662c = 5: 0f3c417efe libavformat/asfdec: implement parsing of GUID values 6: 9988ecc6d2 = 6: 3bee11e40f libavformat/asfdec: remove unused parameters 7: 3b5695c25b = 7: ca9bbc79de libavformat/asfdec: fix macro definition and use 8: f1af8c82fc = 8: 238290bbce libavformat/asfdec: remove variable redefinition in inner scope 9: 2214e02e7e = 9: 654e44d526 libavformat/asfdec: ensure variables are initialized 10: b60e0bcc29 = 10: d461f039d2 libavformat/asfdec: fix parameter type in asf_read_stream_propertie() 11: da268b909b = 11: f606f322bb libavformat/asfdec: fix variable types and add checks for unsupported values