From patchwork Sun May 8 03:01: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: 35695 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2387251pzb; Sat, 7 May 2022 20:03:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyitmPP12DibUEIxpM9ANpmKh7GxCfM7P01iiMwu3yE36+GfPcjj8iZAn4JSy0p7u2AAU4M X-Received: by 2002:a05:6402:909:b0:416:6f3c:5c1d with SMTP id g9-20020a056402090900b004166f3c5c1dmr10799647edz.108.1651978980258; Sat, 07 May 2022 20:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651978980; cv=none; d=google.com; s=arc-20160816; b=YYH0uyNjjl5B/1ACMlH1+1xHkUGPoyRQZzt4YNc0n0nxLUEPDS66vxfhScmHXLvr2k 44Xh38aJf/813dRnKS3fDExG0QWispZaWTW4FhLdSEYG1jt9++8BiPnvPlYbWBUU2Rfo kFBLs6wtVQXcj+/NjgPnE646HX2AQdfwGTI8An01v4W1Mzw5Q6Zg/oeCc3jbRj9I5s78 VtchIgFi/2F6yOTEQxa3kIubON+QQ3FhiOFRJIHsYh4WnAMqvCoGy1Kr0BVMjMYrTsCx 9V054z1UUknfMh7Zt5aTX2WC5yz1GHQnyz314Dq8vtKlwHtyCkmzHmkppJZoAEY47MFk sooQ== 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=Hn/boX+toqqgLJC0+JcoaAL6kipP7ijr6/4KgK3RmQk=; b=ziusoP4SkVbcPsaDuQ/1RqkS5yhCerrf+dmuwMopeDORwpJqn/ELt3AoOPEiYynk/U YUV1TTV7vODxn6+H3dtPEN2yofraFrlwg+fnOSYHvXTnjInScXwAjtrWptS/KstElg6G zNa+HlF/5rOJQ2+IV1SD0JGgiJMCGFlWPVxwt/VX6PW1f69AWs3JPaItgkCBVwjK/2qc qvYwZNQumvoqal8rRpcAvuykdVumvb0rFdzFp3jMaOe0x8oRSDr/cLEoDCm/ypNmYUMr X28TBX8gkik5AWCYPatEGVHIeTOb7/gdnSxiRxCe1pJGacNhm1UtOHHDaN2DnFfynDgO MiUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=dQGkaOOg; 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 l13-20020a056402344d00b0041d983f82adsi3611925edc.43.2022.05.07.20.02.59; Sat, 07 May 2022 20:03: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=dQGkaOOg; 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 759FB68B3DE; Sun, 8 May 2022 06:01:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 283D768B3CD for ; Sun, 8 May 2022 06:01:32 +0300 (EEST) Received: by mail-pf1-f172.google.com with SMTP id p12so9509064pfn.0 for ; Sat, 07 May 2022 20:01: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=uVlPASh8hnw8oWKHc8DN6rK5jFBoknDfgebCfWYWoe8=; b=dQGkaOOgtU+IlsLlqErFXGR4DKhRgFwg8Zv1Hb3iqXDkjU51gZg3f7CWPnQ64dDkHA +T7dOBpG1oPzCZwGh2U3NQjX+RYZkssp5pINDwsu2TMguO7EJRpgZQVe8YgHiRLmXIXJ TtEjmSK2UEm/e9I8KsA6elCdxllORpcGMWhScGAJaRRVoH2k0P7ik5I7skl+GZ/+GsmL gWNHp5392hUA/6QqahwlTfZzLihl93xUyo0dLqx++VFPfwpaTb3VtF+hQ16QKiZQ8AAm 6Zpkuye0JT8hAviBV0U73U9dMvkyz7PNJrm96gH953ocCxKZh036JjJpQnbyNAX8RtSc ojWA== 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=uVlPASh8hnw8oWKHc8DN6rK5jFBoknDfgebCfWYWoe8=; b=7qOga1m7Pg1MCsHJX+oFEGAkzdMW9s+H/39c+6oPq6CK/roWsqrIkaHwxScQeibSo4 8fKx5ViPYBvHqlrw1FElpzjYTKVMioR6NmVX4U2SeDPHaAQrY/tsUoUK+Bnel1zmvoCT ZEoKC6E4wU8H3eg2KfsgcRBXcaoPK0o6ZtjpsOFyDHd5TeUp+zmqDdJ4FxgP4wYxoABb 7sRHEUGBj/gACunlzar56Ie3e+Gxz+MHKDnnYUaDHcRNzpGknrTIi5nVfCLeYyCbbsyO tUEvSLXOFVcvYjLvbfFt8UFDUW2hk+Ptbnot9kqVCS2g4KbNWO3Se9Q+FH7115zrg5Tl sl5Q== X-Gm-Message-State: AOAM531c5ztN7IaXR6buVSSSDUE+nHwNtUrR7BFoKTCANjFFbLUaGK1C ZIYHPnQmuUqj0uIkR2lhNZgQBtN5kS0/Ng== X-Received: by 2002:a63:90c3:0:b0:3ab:24df:fa19 with SMTP id a186-20020a6390c3000000b003ab24dffa19mr8278243pge.608.1651978890662; Sat, 07 May 2022 20:01:30 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id s7-20020a170902988700b0015e8d4eb1f2sm4387183plp.60.2022.05.07.20.01.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 May 2022 20:01:30 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: <273823a5b4908e247c387014c0b40887ceac3ea1.1651978882.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Sun, 08 May 2022 03:01:18 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3 07/11] 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: bqnSS3L90ke/ 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 19b4a5fad1..9a6f45d9a5 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -905,21 +905,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; \ } @@ -1002,9 +1002,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)) { @@ -1065,9 +1065,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); @@ -1143,7 +1143,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;