From patchwork Wed Sep 30 16:59:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22673 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 B9E1944797E for ; Wed, 30 Sep 2020 19:59:41 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80A2568A0D0; Wed, 30 Sep 2020 19:59:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A12756806A5 for ; Wed, 30 Sep 2020 19:59:34 +0300 (EEST) Received: by mail-wm1-f67.google.com with SMTP id t17so231489wmi.4 for ; Wed, 30 Sep 2020 09:59:34 -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:reply-to:mime-version :content-transfer-encoding; bh=nwoDC/BKvo0ebkP0yA/WogLbWziktim/eV/iXU7et4g=; b=g359iMntwpFLe94fq03BUXjvhy+F4f+388iHmxe7MiZZknxUA9znnnbAhYRcCEMnpv QfrZJkwXtrxSgBOWvHKb45/fywX6yB13/Bo7pqWQMiuMMt1QmToU0rIEg6ysblbrVJd9 ap1Se8Ts6wS+3EWs9w1uUAYfoVhNFvXZj/lC7pYy2FbHHgW2Q326a4L8y6TsMh3G0+aB vRq9pjuMiR+eN+lTmdnbSLxzV3sjLfCaSfixIgQiAHz4JmcuuLCg2VfnuRt6E6E6Ii+Y dFsUmwGogVpPb1pQqVadMr2Q8zMePHmbiDz8YBqHl7Fly6S3B8x+vo/rKSPV26lR3WEr KvrQ== 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:reply-to :mime-version:content-transfer-encoding; bh=nwoDC/BKvo0ebkP0yA/WogLbWziktim/eV/iXU7et4g=; b=VVWkG6GpZ65ePveIVz4S35k5DLmWY8QrortU+2f9F5bIDxO1cX7P1jI8U/JqiVldbF DspxtIqNkKeWXxUYdJNuYzVG/PQrE2i0bkp8IUJqlJw1lFg/M2Idbhvf7zLhRAP2Gtgd ALRKXHTIuD/KJ4Qf6QCzzcUtwwO2PeLOI5atnAhO73sATjlksbvlE+V7j3nQv757P+FE dFCviiyCujOfXDtrhTsoOcjz0v41ix220RBuj8d7N6s1xnHSuoQDEm164CWSOZqQzPyN r0+F93htjzdUbC117FD8WXVxQoL8eXiiRhZh3AKoamEcsYZSivHc+8cFnNyWOgSY/4ti Xe8w== X-Gm-Message-State: AOAM532+07pG2SO7aR0Zb8d9M+z0XfUfmmddvLViMvPzWlE4w29QDmB+ agbjcbPIZSCa+Z8+YrnCKQ8ErOgXJCI= X-Google-Smtp-Source: ABdhPJwps35xNOL8V62t7nFFIRSVjYwedSr0qyUkpq+rW7Nxfpnc11NTKpUXNHC3PZUOcGtICRzCwQ== X-Received: by 2002:a7b:c959:: with SMTP id i25mr4228135wml.39.1601485173455; Wed, 30 Sep 2020 09:59:33 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id a15sm4453982wrn.3.2020.09.30.09.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 09:59:32 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 30 Sep 2020 18:59:24 +0200 Message-Id: <20200930165925.1244016-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: Fix segfault when remuxing rtp hint stream 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" When remuxing an rtp hint stream (or any stream with the tag "rtp "), the mov muxer treats this as one of the rtp hint tracks it creates internally when ordered to do so; yet this track lacks the AVFormatContext for the hinting rtp muxer, leading to segfaults in mov_write_udta_sdp() if a "trak" atom is written for this stream; if not, the stream's codecpar is freed by mov_free() as if the mov muxer owned it (it does for the internally created "rtp " tracks), but without resetting st->codecpar, leading to double-frees lateron. This commit therefore ignores said tag which makes rtp hint streams unremuxable. This fixes tickets #8181 and #8186. Signed-off-by: Andreas Rheinhardt --- This is the mov-equivalent of ticket #7079. libavformat/movenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 265465f97b..7d89cd579a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1652,6 +1652,10 @@ static unsigned int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { unsigned int tag = track->par->codec_tag; + // "rtp " is used to distinguish internally created RTP-hint tracks + // (with rtp_ctx) from other tracks. + if (tag == MKTAG('r','t','p',' ')) + tag = 0; if (!tag || (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (track->par->codec_id == AV_CODEC_ID_DVVIDEO || track->par->codec_id == AV_CODEC_ID_RAWVIDEO || From patchwork Wed Sep 30 16:59:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22674 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 3EC284494C3 for ; Wed, 30 Sep 2020 20:00:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 249CA68A154; Wed, 30 Sep 2020 20:00:40 +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 248E368804B for ; Wed, 30 Sep 2020 20:00:34 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id e2so253800wme.1 for ; Wed, 30 Sep 2020 10:00:34 -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:reply-to :mime-version:content-transfer-encoding; bh=T8YevhPzlFPN2m9EXADczzZWYf8TPnmVgwnn9iwOERk=; b=ktQK7xwp39QLBYtzl9XfHEpVizeSyEdgLmj4dvhYjCxPzuWiMI1JxFml6DBYTYDD4Y niiUwzlQ1IVB2GNhhA+4J/LB/Na5akTuHQVZw2H7bLXAQqCetVQjw4npVR6CLlKTJSuN E6ZOqf5wpGga2xKyO5uwe1K1+vyL/E/n1Yem8Kadw0vRDQX2u7KyrzNAMh4FypdGfV40 c7eRGCk/6g+hCqmp3hJydGvbCRS96WPkBok0kphfcyPBCxq5ywm3bb6jgBaeMZzFmX+k hZOZmp0X9zrljGRPhOk2bQ4prEY1c6M8yrE+pfSp57GsrBhPSlcmXAHMrgDs/eVFA9ZR Rzsw== 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:reply-to:mime-version:content-transfer-encoding; bh=T8YevhPzlFPN2m9EXADczzZWYf8TPnmVgwnn9iwOERk=; b=GpT+vBW/nkhUZA9/yechQxdKUrhZ6pXS9vhuYBwPor6BwycZFoofjCG0Q1oNJYdHBQ E8mekNVZZqb/6xgcyC8Kq2BBDE/6o6rmHJ2N3kjdAU2XIXRH8h+crKAlnqtT5m1iv1Wr CWckJTOW52jcAekkuszM99RSBvNCjbkOZgXCGq2wPqgO/iOzPAM0Duq3+0LuSRTb2FZ/ vGtybcGMZhRVEq2hSuhN3Msg67rEfeGv7StTNF6YyQhBtZ/RTAc4lZfl56keR+xnJ8st tVN/d9tj3IrcO+OgcmgKQHbpfa4ZFMqU5xV6cNJtZHeAkIQb42qDt2uT0fPid/bt70LU sPMg== X-Gm-Message-State: AOAM5335vUmiUoMngJBAyCkl9JDKBKym/uVy65g5kZXV/j+pjK36NvaO dfstqawZp5UVBvq3jPgFtnFFsXIIGCY= X-Google-Smtp-Source: ABdhPJwqWjgCwjg0oJhoZ27OEylNDo79s2vlx4aW0dwTRoOx5X6kcVEItvjIyiH/FVvDEd1DClxwIQ== X-Received: by 2002:a05:600c:2f8f:: with SMTP id t15mr4191359wmn.41.1601485233271; Wed, 30 Sep 2020 10:00:33 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id a15sm4453982wrn.3.2020.09.30.10.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 10:00:32 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 30 Sep 2020 18:59:25 +0200 Message-Id: <20200930165925.1244016-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200930165925.1244016-1-andreas.rheinhardt@gmail.com> References: <20200930165925.1244016-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/movenc: Make some AVCodecTag tables static 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" They are not used anywhere else. Signed-off-by: Andreas Rheinhardt --- libavformat/movenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7d89cd579a..6c10500149 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -7113,7 +7113,7 @@ static const AVCodecTag codec_3gp_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; -const AVCodecTag codec_mp4_tags[] = { +static const AVCodecTag codec_mp4_tags[] = { { AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') }, { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') }, @@ -7149,7 +7149,7 @@ const AVCodecTag codec_mp4_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; -const AVCodecTag codec_ism_tags[] = { +static const AVCodecTag codec_ism_tags[] = { { AV_CODEC_ID_WMAPRO , MKTAG('w', 'm', 'a', ' ') }, { AV_CODEC_ID_NONE , 0 }, };