From patchwork Sat May 14 20:55:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 35773 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp876730pzb; Sat, 14 May 2022 13:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7qnbDcDHkXef7Xl8zhvqCKfhmrahbl9dxShzlacIy8BuCftwYkzQriOUWaghzyWBl1EC4 X-Received: by 2002:a17:907:d91:b0:6f4:c817:d492 with SMTP id go17-20020a1709070d9100b006f4c817d492mr9798215ejc.407.1652561805038; Sat, 14 May 2022 13:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652561805; cv=none; d=google.com; s=arc-20160816; b=z0zctNKoclCDMVq9EoXXHTRHM3t42xoNYh1OpO05AmvWHGwqjb7w8F2bvL1PxaT29y jlr5FE8oPboNPMgO6Ap9NTFWFpcvYgicU+C8v+7GSnAyk4JnZ1APBKsviDgl7CxGZxcN YIlygcLxJkCAyxBvc2iFUIK41i9LFA7TNzQ3iuvyl1CVqRh2R1mrq0uVKTSPHY3j+v/u oHmSf9eAooptdlXIwp+iII4NmJrETLwoT6zZoRytSFbhKWiLTVIJJSR6qm1H/tAGBtkh YDUoRK4yK1Pv/ZBCrFivOpJucXeC0JB1H3hQzRAfjZ5b7YuCIC/f1JsSTQHxkA6OaeSb JE3g== 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:references :in-reply-to:message-id:from:dkim-signature:delivered-to; bh=WuZ79bMdOgFtg+L6rXyH11ao2lGBv+oF9ZTv+L474Tc=; b=xhUFfJ+d9FeWOYhvSdp/gziRMIwJh4n16ZP25X+mDC3C+DEgH9vCvoUsSz3wki22C9 /Zel8QdkT2jqWyzIdyx2MMjlI7xxxxqAeEcvOLVEM1ysVw20lRum1GhemT/ZJqqmnojZ KztlKA9Rt9cH31ocoKS1ESwDWHDlylKagSWvfXgDVUg+7iP+0S4dxL/dGnYMYrVzyR16 2gD/krUPT3rXlQ5IwalzSu0xGxPo07dH4oCeOk46Ww+GBNi9erBr/O68ZKytTg/zzvUq 8WrA/kG7jQ3AYY0VpD+BfERIZ9qIENs2HC39j7qLGkuiaMxeqQbjsKtGRYlAhpOJ3Iqf 201w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=hDmD3oGW; 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 gz12-20020a170906f2cc00b006efd1bca356si5410757ejb.629.2022.05.14.13.56.44; Sat, 14 May 2022 13:56:45 -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=hDmD3oGW; 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 6225668B4BC; Sat, 14 May 2022 23:55:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D81868B480 for ; Sat, 14 May 2022 23:55:32 +0300 (EEST) Received: by mail-pj1-f49.google.com with SMTP id gj17-20020a17090b109100b001d8b390f77bso13840044pjb.1 for ; Sat, 14 May 2022 13:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:in-reply-to:references:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=XjCO4keXQfoCynY7AYZDsIIXwFiPa/O/T5YzBRAgx6Y=; b=hDmD3oGWO/+S1na4neXo4jw1h5zBJpUDjweXcgsyjLtHH8azR835whahOwJ06auy1z wy9JT+3ASr/Tdqy9BeWPdShe9jOWUDSJGnNIMZ/P1IsBjT1Zs9fYQ5k2OyIrJQtxe1jv PbnN8s8u1c6M6ds9SJlOjNKpcFumZS6bK7yz8cYTw2N2sHUyzt1+hiLuUu+E26rd8bXR TtZLwt9OcHojS+uXNwAiAAPADfi+WjXJCUjwQocrag4JlDqdRqnlI6yhRSxy63GzRos3 OzsiM6KKui7bIpQybPI+GsOzqCfA8MPFlyKQaaCKkSaSab2LO0yt/O1n7OlCY0++vwnZ 8Bdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:in-reply-to:references:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=XjCO4keXQfoCynY7AYZDsIIXwFiPa/O/T5YzBRAgx6Y=; b=ZBdYwBxuV65XYJ4dswQp2eynICRB2rwiTUFND4hWA0x9E4V0HL1mXJjLSSlkk0PUZB obS138kdadLGWyx7Iu2bkfc4i62i7mt1fq9aKF60MZLW5DLJWVofWu+zOPgIyEJwzRem LdltCzKUkmww6eLNP7d5hYoMd7YXJaSy3Zck90y0RF5A5XZiFfb78tadSxavv6IQ3C97 snyj0L1ELmg8/AjTwEnGG/8uNaeE4jxvLBIpry3Qg8nK0MdpygV35pQNh+jd7xxL80Zn 1Xu+NrdBbK0wAf/z/bH7iRjl6jjWVT7w7DdXw3SnxE7zhaF5r+u6am+RPueFwzQzE4w+ pLcw== X-Gm-Message-State: AOAM530YAA95rLactw25MbQPlRn4c70j0QWoeLX+t7A1Ob5znmIz1GZP gSJtELO/ILPDmSf3WbOmR8uSUZPP5ZKJJA== X-Received: by 2002:a17:90a:fd85:b0:1d9:6281:d158 with SMTP id cx5-20020a17090afd8500b001d96281d158mr22648707pjb.187.1652561730436; Sat, 14 May 2022 13:55:30 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id cw15-20020a056a00450f00b0050dc76281a1sm3998276pfb.123.2022.05.14.13.55.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 May 2022 13:55:30 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: <33b3d163dfcd61ae6f4ac258ae28fa0756436587.1652561722.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Sat, 14 May 2022 20:55:18 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v4 06/10] libavformat/asfdec: fix macro definition and use 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: Michael Niedermayer , softworkz Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jHCYv694MpyK From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 81a29f99d5..91c3874ac7 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -906,21 +906,21 @@ static int asf_read_header(AVFormatContext *s) } #define DO_2BITS(bits, var, defval) \ - switch (bits & 3) { \ + switch ((bits) & 3) { \ case 3: \ - var = avio_rl32(pb); \ + (var) = avio_rl32(pb); \ rsize += 4; \ break; \ case 2: \ - var = avio_rl16(pb); \ + (var) = avio_rl16(pb); \ rsize += 2; \ break; \ case 1: \ - var = avio_r8(pb); \ + (var) = avio_r8(pb); \ rsize++; \ break; \ default: \ - var = defval; \ + (var) = (defval); \ break; \ } @@ -1003,9 +1003,9 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb) asf->packet_flags = c; asf->packet_property = d; - DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size); - DO_2BITS(asf->packet_flags >> 1, padsize, 0); // sequence ignored - DO_2BITS(asf->packet_flags >> 3, padsize, 0); // padding length + DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size) + DO_2BITS(asf->packet_flags >> 1, padsize, 0) // sequence ignored + DO_2BITS(asf->packet_flags >> 3, padsize, 0) // padding length // the following checks prevent overflows and infinite loops if (!packet_length || packet_length >= (1U << 29)) { @@ -1066,9 +1066,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb) asf->stream_index = asf->asfid2avid[num & 0x7f]; asfst = &asf->streams[num & 0x7f]; // sequence should be ignored! - DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); - DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); - DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); + DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0) + DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0) + DO_2BITS(asf->packet_property, asf->packet_replic_size, 0) av_log(asf, AV_LOG_TRACE, "key:%d stream:%d seq:%d offset:%d replic_size:%d num:%X packet_property %X\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, asf->packet_frag_offset, asf->packet_replic_size, num, asf->packet_property); @@ -1144,7 +1144,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb) return AVERROR_INVALIDDATA; } if (asf->packet_flags & 0x01) { - DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal + DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0) // 0 is illegal if (rsize > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); return AVERROR_INVALIDDATA;