From patchwork Tue Oct 20 11:03:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23111 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2950944A5AB for ; Tue, 20 Oct 2020 14:03:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4C4568B9F5; Tue, 20 Oct 2020 14:03:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33ADA68B9DA for ; Tue, 20 Oct 2020 14:03:42 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id q5so1387476wmq.0 for ; Tue, 20 Oct 2020 04:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wX6QVn0YTvZ7N1LqHt7ZGEc5KvDpXo2CuDFQVo0w4dQ=; b=Hpr02adla1JeQUAAF2Ur5RWWwyiTpnqvr67Z3kPVpiM/bX8tMKSgw37/RfjO7fD2rs ViRF1/DdICK+SO1LMEbGnsJded0MT3OzB+qYPtGgH10nsi2f5nXt1gV6C7/yAs9bl9GF zMmxRZn9oAPa6a7vdmxnBMTc3b5m/r/hRVkTrMMFLJPWFD4ZB4jCPtTaM3/TycbgFl7/ a8pCJEoTYbnusXMSs+bhi8PJmehHPBBxvWHbdkpdj3g3vLFNeazC1+xHJvs1PCI+JJZN X4xCtxGIMnwABDipLy9jG2Yle5nJU+hv89TkEfg8m4fDlEzdR8B3uJwcZAW+NMnLF10g P6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wX6QVn0YTvZ7N1LqHt7ZGEc5KvDpXo2CuDFQVo0w4dQ=; b=K69q2cspK1iUemxR/FwVjVEyxKtmw0kYe/5jA7jgTOucqoW7qu0INqoQ67LGafTT0s 4b14khUQ49dzVQiD5rL47viyMBSc0VI/a7JGzqYqPGAvkUlkHhM1DdSOGY/wnPgT8AB9 XohkmY5hitg/swXguY/pqr+O7phk9LmxsfpnNHiyK75eLEXEBeDVF7WSrMBjRnE3+NJ/ nnHKx+FVV6m7mql1VH+B7I960itJBxbD8VXBYDbGOMvyxvYVk2oFOQiXLUPbiprLu8hE XUnVCa90hUQAd6Ko1iU91bPNWmls/jUQ/dHxgDs/IxhcjogqTrQDf86/H2kTGsuFTYsI uhHg== X-Gm-Message-State: AOAM533UP4jq9dL3RiB/NZQKE0vzY8OuS1JXBo2uozgDADsIBtMfHzgG 9EvdnyVU6qhW5WxoPEJ75veKvK/kZt0= X-Google-Smtp-Source: ABdhPJzSWOWrJMt0UwJgjxhUGmsroLqGpDsIrzORkyfWE79RINEO/HQ9xWcjarP3BFlhrpMq3+5FOg== X-Received: by 2002:a1c:a509:: with SMTP id o9mr1897494wme.33.1603191821244; Tue, 20 Oct 2020 04:03:41 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id c18sm2413075wrq.5.2020.10.20.04.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 04:03:40 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Oct 2020 13:03:31 +0200 Message-Id: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] avformat/hlsenc: Fix extradata length check X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Commit a2b1dd0ce301450a47c972745a6b33c4c273aa5d added support for parsing annex B HEVC extradata to extract profile and level information. Yet it only checks for there to be enough data left for the startcode and the first byte of the NAL unit header and not for the full NAL unit header; it simply presumes the second byte of the NAL unit header to be present and skips it. Then the remaining size of the extradata is calculated which ends up negative if the second byte of the NAL unit header is not present. Yet when calling ff_nal_unit_extract_rbsp() it will be converted to an uint32_t and end up as UINT32_MAX which will cause mayhem. This is solved by making sure that there is always enough remaining extradata that could (pending 0x03 escapes) contain the data that we are interested in. Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 8e4cc36d50..49c4ab5966 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -349,7 +349,7 @@ static void write_codec_attr(AVStream *st, VariantStream *vs) level = st->codecpar->level; /* check the boundary of data which from current position is small than extradata_size */ - while (data && (data - st->codecpar->extradata + 5) < st->codecpar->extradata_size) { + while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) { /* get HEVC SPS NAL and seek to profile_tier_level */ if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x42) == 0x42)) { int remain_size = 0; From patchwork Tue Oct 20 11:03:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23112 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3491B44A859 for ; Tue, 20 Oct 2020 14:04:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 17C0368BA82; Tue, 20 Oct 2020 14:04:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5EA2568BA81 for ; Tue, 20 Oct 2020 14:04:07 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id c16so1387243wmd.2 for ; Tue, 20 Oct 2020 04:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UqIWI4qmo3P+EfmPVa/7TmK4uLgGx2+J4pcwEEFeVAQ=; b=eoU3CtV/bkqthlNWPP0FzAQ2u94IiBS+kcjCd5EIeWU6rMgZzYIIYtfXIyopQh7mcj q5uQsvjGdEMirkaY4o01Rxtfxa0gUrFl5V3/9e6fMN8r9FTFAAPr2ECGI0kBZ7ba4zgo ZcXRWw09ozL0CT7TGafjmTadedEq9+YwzO9pQju3x/VMMJMPsIOoJMNeI+awJHph3rs5 aO7VBwj+2sWBkNmma+dq/9IQLQ16bMFVmJG97jfPpsIdW4HOIIkoh83OpGUV5r2F13TK b3EhrlLCgLZ4glMHe+YHahFlNralN+EYkAILJDbwp9LK1nOEU4X9FbtOBU06dDOl7Aa1 BXBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UqIWI4qmo3P+EfmPVa/7TmK4uLgGx2+J4pcwEEFeVAQ=; b=kC4gZ9MkEHcWekwpUsVLgc8ourkYgYKIFlJNJ23Nhnpbh1NcfPTENBoyjM1oxqy8w0 /ycS4cKhSt41/OwBfdfstB+jr5qewsEJ/E/BtlOxowZVejBxKD32ngE0K3KYNn9hjjuh u41jk+mvK6tUE3a4EM5hfUsspD6RMGv6NuimZ1um86d2+rSsaHsdRrbkSu2JeRj0iAR5 pamTXv8nKBes8Sn9v9jw1FqTGpUw9+DwR/zhLcDAm1DxtOzpuoD0TbRtxIL/JXX0pMCj wZjYs+v5ycyTobAb/ERpmGSYctd99vdapeVPdZ/7H9Kh2Laj33+2M5lIX4BrF3FNbhJg hCog== X-Gm-Message-State: AOAM531nyH5tv+PBNyjwOvAAmlKsJyYBdYZt3R9dCw3vPWELyUp+0bXz v5YtwFnzsJLdOIevLHyHJxEI+sdbcig= X-Google-Smtp-Source: ABdhPJxEXJ18vCewTxdUCiT5IfB8nkNotX//N0mMOxX1DRQq421aZnSjP6e6OeAhRElI53R2ItI8jw== X-Received: by 2002:a1c:6546:: with SMTP id z67mr2258229wmb.98.1603191846436; Tue, 20 Oct 2020 04:04:06 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id c18sm2413075wrq.5.2020.10.20.04.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 04:04:05 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Oct 2020 13:03:32 +0200 Message-Id: <20201020110334.197116-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> References: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avformat/hlsenc: Don't use uninitialized buffer in av_stristr() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Introduced in a2b1dd0ce301450a47c972745a6b33c4c273aa5d. Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 49c4ab5966..22077073bd 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -380,7 +380,8 @@ static void write_codec_attr(AVStream *st, VariantStream *vs) profile != FF_PROFILE_UNKNOWN && level != FF_LEVEL_UNKNOWN) { snprintf(attr, sizeof(attr), "%s.%d.4.L%d.B01", av_fourcc2str(st->codecpar->codec_tag), profile, level); - } + } else + goto fail; } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) { snprintf(attr, sizeof(attr), "mp4a.40.33"); } else if (st->codecpar->codec_id == AV_CODEC_ID_MP3) { From patchwork Tue Oct 20 11:03:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23113 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2BA6244A859 for ; Tue, 20 Oct 2020 14:04:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18E6368BA9E; Tue, 20 Oct 2020 14:04:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4AB1568BA8B for ; Tue, 20 Oct 2020 14:04:08 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id q5so1388848wmq.0 for ; Tue, 20 Oct 2020 04:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KTmwS0RcxzUGmj6tnDB9wyv91J5Kmyy0+YMw76SE87w=; b=tOC9xetWIoQslnEe94bWnsuecI3w9uXmbqsLgh2ZQtutfYSMi2m7zml4sSrHeFVYiV uiI0ySCO9TvmpOUjXxRO/dpgYDUBaBBnjoUJAWGlCuQMfV+GsaW4ZGR96MPFkZH/Tuwt pZvcUkbh6TgPiOS2ubb0YsgbxGDQ+rJCM/tnfIN8uFIqa4ulzsItjb/GNsyG9ONfCgli pe+DnfH3ixVsT6Exe9qHIQt87PRU30aUwkeVkHwmyTKzLitT0qErvBpEwUoZn99ZytTD EvX4T0RM3LTBnA9nEZ/nN63M8lcn2vAdqdVHXWmHDlfJbuIbqexXqlaNvmU8CtBH3BjX lJxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KTmwS0RcxzUGmj6tnDB9wyv91J5Kmyy0+YMw76SE87w=; b=WUkZM5T5iS28KkX3kEp4mP4jY61ExAEbtOu8ptjJDpW83p+E+NM6zY5gKzT9MUUHyM /5xeQf3E48GJ7wezhOFLM6FiQiTUzkL7CCGj9GFC8dnIeQddGKvTPK6W+7+sQIPzQyjh 7dKqWA7LevVoXbmOBAbrrrMa+OBBZTP2Y+Sc88+kN05rBfJpcyTzLNsR/Y7w9UPNlgCc BU/z4IeZgGlKtxnWQky5bFmJWfgwMiBDMGv0+Z3vEICKUNLnTb21tDTHufWqBaf5ebBP BqKtndDk/cQX4vUlNGjLmqYf8BqxZ/1T/ep7w2JJkcGkYh0/kRINAy+8KNNKzSOnX87T E6iA== X-Gm-Message-State: AOAM531Mfak5KhGTKi43krccF+Kzbxg+CPYK4G3YaTnDDxM4xKHWCYFR 3j8yBIrin+kyiung4jq+ASgH92g6FXs= X-Google-Smtp-Source: ABdhPJzneoigZnC/JNgHDtx8X/bhmjVz0ubkP5iCffyRJnmuiheg6fOFlmil/b/mTVO4doAq/db8Lg== X-Received: by 2002:a1c:2042:: with SMTP id g63mr2270654wmg.174.1603191847364; Tue, 20 Oct 2020 04:04:07 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id c18sm2413075wrq.5.2020.10.20.04.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 04:04:06 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Oct 2020 13:03:33 +0200 Message-Id: <20201020110334.197116-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> References: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avformat/hlsenc: Fix mixed declaration and code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 22077073bd..4967247bca 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -352,13 +352,14 @@ static void write_codec_attr(AVStream *st, VariantStream *vs) while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) { /* get HEVC SPS NAL and seek to profile_tier_level */ if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x42) == 0x42)) { + uint8_t *rbsp_buf; int remain_size = 0; int rbsp_size = 0; /* skip start code + nalu header */ data += 6; /* process by reference General NAL unit syntax */ remain_size = st->codecpar->extradata_size - (data - st->codecpar->extradata); - uint8_t *rbsp_buf = ff_nal_unit_extract_rbsp(data, remain_size, &rbsp_size, 0); + rbsp_buf = ff_nal_unit_extract_rbsp(data, remain_size, &rbsp_size, 0); if (!rbsp_buf) return; if (rbsp_size < 13) { From patchwork Tue Oct 20 11:03:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23114 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3A0E044A859 for ; Tue, 20 Oct 2020 14:04:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2100968BA9C; Tue, 20 Oct 2020 14:04:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33A6168BA8C for ; Tue, 20 Oct 2020 14:04:09 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id q5so1388906wmq.0 for ; Tue, 20 Oct 2020 04:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mgBjxqd3xPJflmx10o69gkhwrO5M1lLdPdz/Vx2Jr6k=; b=gauhT9pYhLqKI2Eq/VNV6CVwuZ1ak925jNj91B1jLWhWGGyD1JbGfaij2M6U0hyxk5 kQzP8NSGFHsbsRk4PMKvNNwHQ/7X5T4dqMyl+q1CAC4ig8p2SeJBCqTo6SpUTQ79LhXW uxw3GxQyBWb13UbRsBQ/bGuRIJh1mzqwdsgIaUEbJDAVeWWSyPqB3xF2VIuqq7HeV0l8 HNS++ZAbpCcrJFwBphIVIdmUxbdxBd0yDS57XSCeU+6h2LFnDMweL2xfJ8Fq0276yk9K 6KKeeb2iHkGoWLjIY9eECbrkgC6Hall7iebGxRT/jTXr0Ycsizcvf8aSzlkE1hJ+f8F4 4QPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mgBjxqd3xPJflmx10o69gkhwrO5M1lLdPdz/Vx2Jr6k=; b=QaWOLgvxOOD1S0/guClgD6p32q+BYam7IaP8js2o+Cn8R7bLV46DrlvbzdQJ6ihG7a qDE3f7ouGY6oks7pn9yHnqYBUOMIRqKmKtuRX7r4z/gm5sQIxLFBouNJNUvY9NpmwGb3 7NfUf8+NA3cT1Sva3TgVAD7zmXt1RF7cRQ+bi2DcFeabh66mJPGQMmcorPE1+CkktihV SJo4xe0gfN2ynUw+cAYTS5RrYUVGd3slUy4FaGm5YTPfxMry72uS6uYvFN05Lyyg/MZX WXOyHchENoqI1eTz3NPQlkOMlQ6yhbo45qq3ZwYgSHktIB9Lnm2OaJyTkEv/HeNiOC3G Nxjg== X-Gm-Message-State: AOAM532/L3D5y/MT8rvkbJcMudRaXB2kHKlLpNFpy0IutSems2vK92fD 8N2HGTTB1bkKdLG0Oklo81p9AYLmXr8= X-Google-Smtp-Source: ABdhPJwpYxlAH4ibP1skpnw6iDIr6HDY+mTiKwZKATZvQ5k2YZm4PmKuzHE8mtqSGU4pjdT3x9YcuQ== X-Received: by 2002:a1c:2e53:: with SMTP id u80mr2388466wmu.58.1603191848355; Tue, 20 Oct 2020 04:04:08 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id c18sm2413075wrq.5.2020.10.20.04.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 04:04:07 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Oct 2020 13:03:34 +0200 Message-Id: <20201020110334.197116-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> References: <20201020110334.197116-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/hlsenc: Fix check for SPS X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Check all the six bits, not only the two bits that are set for SPS. Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 4967247bca..cbfd8f7c0d 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -351,7 +351,7 @@ static void write_codec_attr(AVStream *st, VariantStream *vs) /* check the boundary of data which from current position is small than extradata_size */ while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) { /* get HEVC SPS NAL and seek to profile_tier_level */ - if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x42) == 0x42)) { + if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x7E) == 0x42)) { uint8_t *rbsp_buf; int remain_size = 0; int rbsp_size = 0;