From patchwork Sat Mar 16 04:41:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 47118 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3942:b0:1a3:31a3:7958 with SMTP id ac2csp255027pzc; Fri, 15 Mar 2024 21:41:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUfXQp8+yTxSpSmCkYxYk5BQ5sjHqvH5PUkUkUNLEsfQvCaObkaRYCK9/QHtp7JJpkXCpHHfM8InRFoj/G2a6baU9040fndKtMOQ== X-Google-Smtp-Source: AGHT+IGXnNgFgqkoGgXHfID0bngUl0HH8SVh8STIDgqLTvLu7TnjXrpLVVdhZjac7H9K/hmr0L4o X-Received: by 2002:a17:906:711a:b0:a46:1cc2:3b8c with SMTP id x26-20020a170906711a00b00a461cc23b8cmr3742729ejj.20.1710564109519; Fri, 15 Mar 2024 21:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710564109; cv=none; d=google.com; s=arc-20160816; b=nDcJnAlQywdXoCNFsEG40Yef19bNzF3Yy5etPymBZG+b2jpgrocwlBwERCwm21R77l sZ1GpcT0CHlRMwIp/ikBbuJgYQo26PsMAIS8KEeqtuM+I46v1o0+tmCdG+AhGPV57lHN 8pZyq7Zu0vMSWR+fs4zEi/vEtqSiutZtVVTsaS7VeS4Xm4bSJiPl5eHs1IrrtVLn4lMU N/sw260SxqlDy/IGRaPeC5RFYrn+Njknj8j36Wj/D3Hl5bc5cOy7xGduuU7QE5Ep9iSA OAJoICXNd1D/2SvcP6w1rxwEtlmSfZe8ETX1XzNuHmdWYo3cR85DmM6YKbF4SVd7HnxJ vwkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=iCBAXRyQsfSV42/7F/b8mJMyghMGpZbarrgaAQWWoq8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ZwmanSzpQdlsaoe4la1Y4vkrKenGI/7H/nLPMjqSyclPgSyZDQSKVXpu/ODbeZ5cDt OnyXD2yBf0UROn7yrlDn2oJOlobUQ/tGV93+v3T+m2T7bviY16uD5xup0eOeb5WQ3r// Xyq+3TokRL1TouAfD2MreCoEo1dAPBnRypiOuZ3k6/Dn0W1FRIfS6kLqLh7R0r6cYVps VHocpBByp8weZ/n9z30Tjt99zPhgu4q9I3UvuqnHeEzid4OCpsi6NVptkNjIwchyoham CMRh8TCrTDVAiqK45ZvYeI+qRoBtK9o4ms6KdbJEzd7TGqZV4QK7s4qGDyelMK5SMPtn m5FQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 ht17-20020a170907609100b00a46608e2ff6si2385862ejc.243.2024.03.15.21.41.48; Fri, 15 Mar 2024 21:41:49 -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; 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 32B0A68D0A6; Sat, 16 Mar 2024 06:41:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9029168CB56 for ; Sat, 16 Mar 2024 06:41:37 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4TxT3L2j3hz9sWZ for ; Sat, 16 Mar 2024 05:41:34 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Sat, 16 Mar 2024 10:11:16 +0530 Message-ID: <20240316044116.1319-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: correct bitstream check 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ijerArTQ6gcs 8559cce3c3 made the bitstream check generic using a LUT. However, one of the comparisons which involves a bitwise AND and equality check is faulty due to operator precedence. First reported and analysed at https://github.com/streamlink/streamlink/issues/5876 Fixes #10908 --- libavformat/mpegtsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 06e88e9879..b8efc535a7 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -2319,7 +2319,7 @@ static int mpegts_check_bitstream(AVFormatContext *s, AVStream *st, pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 && (AV_RB24(pkt->data) != 0x000001 || (st->codecpar->extradata_size > 0 && - (st->codecpar->extradata[0] & e->mask == e->value)))) + ((st->codecpar->extradata[0] & e->mask) == e->value)))) return ff_stream_add_bitstream_filter(st, e->bsf_name, NULL); } return 1;