From patchwork Wed Jun 22 11:26:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 36381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1a22:b0:84:42e0:ad30 with SMTP id cj34csp2775600pzb; Wed, 22 Jun 2022 04:26:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tOd3G1iceIkRyK2oEehFFuouKSGJqlIV5/e7WrNhdwR6cDHG/PN2M1GY4biYngIzJZNB5m X-Received: by 2002:aa7:d5c9:0:b0:435:8099:30e6 with SMTP id d9-20020aa7d5c9000000b00435809930e6mr3584669eds.384.1655897184910; Wed, 22 Jun 2022 04:26:24 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ne24-20020a1709077b9800b00718bf771995si8128934ejc.766.2022.06.22.04.26.23; Wed, 22 Jun 2022 04:26:24 -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=@outlook.com header.s=selector1 header.b=QcdMlH4q; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EF8DF68B687; Wed, 22 Jun 2022 14:26:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074025.outbound.protection.outlook.com [40.92.74.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C281F68B5C8 for ; Wed, 22 Jun 2022 14:26:13 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XS9k41mgglIJjo7bYom2f0b0LfeI6Ox881ZgjCPGQ8Js/0gLhzN5eoHkyLKx/0Ld6Cvd1GNHf9w3GAph83w7K/xJxTnLGDBP83Qg7SPW36Cde4Y6EZey/4L9nB8W+KOncPQixvjCQVh4LKqI6jPExcFYG3TiOMMq/Q8nBY3QLGTHrFodwQYp1aOHgG4Tk6pgHuV7KbbHOhmDJpm4EhaSHjJ5WD+3WZOXqxzO6x0/TWaFbKdUQbykDyQr/RN7m96vWBp6wKvXu0ulJvjdleLsTLfuLdh84b4qrIAk3hcPsJXxApKZskVV1Piwuu9WQAK8SE+vxyS4JOHTteGx8jiu4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UkTUThu7Ok9EVJ+TCh4AJuORah5fJOlw9A/0G3C0PIM=; b=cECJfvG0MiTQh1JZNheA2ZxAwDlLvOv5UQjcYnkTeUFUNSd2PMS8AFgRaFRC2MCqXIyp00G3kicRR+LQwQN9Mngg1l1vam97k2S/tWKEIQP9IAGo+TLI4ryi+EUa5/SBWtH/V0PkNjMHPcRMDV8hv4q6n2zTtQE1d1ETQnsB0r6NCDb+Rqyi+InnbK1N+XyUSbUs/Zeoyg5uzXQHdvSc6D4jJOZsFADL7xm8j9Umre9e/8WKjMWexm8ss+PLTZqeTMCvLQ5Ed8GN21NCqook5kjKcTQy5kjaHyopAzNRojBbVa9MIPHTCpOkcbNLGyLDb2N6QIKghWScZu42Y5QX+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UkTUThu7Ok9EVJ+TCh4AJuORah5fJOlw9A/0G3C0PIM=; b=QcdMlH4qvrY2XP9TDoMEtEbxOAnEfP4iyRCys120cobovhrrRNjYXkF0awucNwwHHE8kHWoriBAEYI1gyIsypiw2zQYbBpoARAnT9417F/i18OvCRMyTTOVSo9cf77MuCi3B3NY1ruyxNOZ/lwEoiMja9QUwVfpmErU03CtgLnP6lfNQxlfw1CKzSDSIrF9CvvXhPVEnXEieSQQ+2h/4+viNH/olAacAleLQ+eMltoCpOffMWHllPZH6PFtcGWGtiinlBcsYB8NzpU6LwbWEoqfkZ+KtR3DAZvJAeLfX/ZfKwNEfOIKKitXMbu/Ptd/tfbs/ZoTBM25on4vziFqnMg== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by VI1PR0102MB3421.eurprd01.prod.exchangelabs.com (2603:10a6:803:19::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Wed, 22 Jun 2022 11:26:11 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c%10]) with mapi id 15.20.5353.022; Wed, 22 Jun 2022 11:26:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Jun 2022 13:26:03 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [J9tOJEOEpuPX8IMhoR+4sPqMmvD0zg1x] X-ClientProxiedBy: AM6PR08CA0017.eurprd08.prod.outlook.com (2603:10a6:20b:b2::29) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <20220622112603.1257061-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d99b1882-c892-4486-e937-08da5442026e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRAkauAoWA5v5jYZEoFBVk6OZiWdrEStgkE5zVf1J8pIsOEPGtOHtcRkhKsSgMMh4g2eBU2zrosLvS/epvlrKfCZSf8O2zgyzxmA3Q5s5ysjbBJKgz+XSRmFOXHKtVxc1XiO0LAa0AXo2EAf1KMk/BFRRFqyl4FmiJlLcGyaV1/VahSSgKtNNzxF/Y+ZtCNnr+ir280RM/agp1jAx63d892UlRhXT9MWpI5YLv50VvR3V7CSen45rszDaQg8lVIPM568iwVEqFMw07kQje9afYHG0HUZ5YZ/W5EWlXTeQA45swvfYoWK+WPfnZMKbiqj3Lc8pcocP71gx7jtj6+sEFnaErgmReYWqwNT8gqDMQ8BfeH86ZtFn4FfX5MJ3AGUcw6sol0bH30BijU/MrJL6z5Q2TGhh6kyNF4QSbUGYl7yth7HMgppK6Ns4g4AgMMkYMD3vUVLyTzi5AFIOgPD4dvT19G/spy+yA0doh1AoUi6VGir3VYPn48omOJTtEB/wDvRMkdvgRS7UIk2eXjbN6NhKoODKsuPpKEdQ/Hfl8KQftdooMGek1f4Q3oidOLb3eMejiWsf2aMSHXikxPq/xDmi4rZv6VWq7nmFlNRUglbrIHnkPLknES4/7//PHUPzsYvKOttVT6bk5uoOH8oQNGfGr7qD1TokPk5BsJRXPhGhkJzyLTFYStBPtT0f/v6IteWtvfvZmFMCYMVidtIYyWEjz/CaF8CP9YBUoAIrXU4CNMRo/b0hNOYh7h42to0bs= X-MS-TrafficTypeDiagnostic: VI1PR0102MB3421:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n2yeWj8DvVxnvKFK3hAvfEM/bTyr6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E0yJv1VbFNpaNgXkHj6O8EYomQCdnw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d99b1882-c892-4486-e937-08da5442026e X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2022 11:26:11.4556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0102MB3421 Subject: [FFmpeg-devel] [PATCH] avcodec/hevc_sei: Fix check for SEI end 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: EgZfp+Y1RIdj The intention behind the current check seems to be to check for the rbsp_trailing_bits() syntax structure which is always 0x80 for valid SEI messages. Yet this is wrong: These trailing bits are not part of the GetBitContext -- they have already been stripped in ff_h2645_packet_split(). And it is harmful, as 0x80 is a legal SEI message payload type (namely for Structure of pictures information SEI messages). We ignore this type of SEI, but because of this bug we also ignored every SEI message in the same NALU following it. Signed-off-by: Andreas Rheinhardt --- libavcodec/hevc_sei.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index a5c7df34b0..953633f4bd 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -549,12 +549,6 @@ static int decode_nal_sei_message(GetByteContext *gb, void *logctx, HEVCSEI *s, } } -static int more_rbsp_data(GetByteContext *gb) -{ - return bytestream2_get_bytes_left(gb) > 0 && - bytestream2_peek_byteu(gb) != 0x80; -} - int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type) { @@ -569,7 +563,7 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, ret = decode_nal_sei_message(&gbyte, logctx, s, ps, type); if (ret < 0) return ret; - } while (more_rbsp_data(&gbyte)); + } while (bytestream2_get_bytes_left(&gbyte) > 0); return 1; }