Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: mkver via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: mkver <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] Revert "avformat/tls_openssl: add av_assert0() for tls_shared" (PR #20548)
Date: Thu, 18 Sep 2025 13:50:50 -0000
Message-ID: <175820345145.25.2061279955581888793@463a07221176> (raw)

PR #20548 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20548
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20548.patch

This reverts commits fd55c4b5f72a157fbb128d0ef203e9922b53552b
(for tls_openssl.c) and c74181a04b5f4e650eae662231e56518daef64d4
(for tls_gnutls.c).

It is impossible for a pointer to a member of a structure
to be NULL: If the containing structure exists, the member
exists and can't have a NULL address; if the containing
structure does not exist, then getting a pointer to the
substructure via &c->tls_shared would already be undefined
behavior (and if c were NULL, then the (UB) pointer arithmetic
performed under the hood to access the member would most likely
yield a pointer pointing to the address offsetof(TLSContext,tls_shared)
which would pass the asserts).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>


>From fa8309d3de658e8a51ee208edb5ecefe29ad561f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Thu, 18 Sep 2025 14:58:55 +0200
Subject: [PATCH] Revert "avformat/tls_openssl: add av_assert0() for
 tls_shared"

This reverts commits fd55c4b5f72a157fbb128d0ef203e9922b53552b
(for tls_openssl.c) and c74181a04b5f4e650eae662231e56518daef64d4
(for tls_gnutls.c).

It is impossible for a pointer to a member of a structure
to be NULL: If the containing structure exists, the member
exists and can't have a NULL address; if the containing
structure does not exist, then getting a pointer to the
substructure via &c->tls_shared would already be undefined
behavior (and if c were NULL, then the (UB) pointer arithmetic
performed under the hood to access the member would most likely
yield a pointer pointing to the address offsetof(TLSContext,tls_shared)
which would pass the asserts).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/tls_gnutls.c  | 3 ---
 libavformat/tls_openssl.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 53306872a0..272603f1dd 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -30,7 +30,6 @@
 #include "os_support.h"
 #include "url.h"
 #include "tls.h"
-#include "libavutil/avassert.h"
 #include "libavutil/opt.h"
 #include "libavutil/thread.h"
 
@@ -157,7 +156,6 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
     TLSShared *s = &c->tls_shared;
     uint16_t gnutls_flags = 0;
     int ret;
-    av_assert0(s);
 
     ff_gnutls_init();
 
@@ -263,7 +261,6 @@ static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **o
 {
     TLSContext *c = h->priv_data;
     TLSShared *s = &c->tls_shared;
-    av_assert0(s);
     s->is_dtls = 1;
     return tls_open(h, uri, flags, options);
 }
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index db7147e491..7068497325 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -20,7 +20,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/avassert.h"
 #include "libavutil/mem.h"
 #include "network.h"
 #include "os_support.h"
@@ -747,7 +746,6 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
     TLSContext *c = h->priv_data;
     TLSShared *s = &c->tls_shared;
     int ret = 0;
-    av_assert0(s);
     s->is_dtls = 1;
 
     c->ctx = SSL_CTX_new(s->listen ? DTLS_server_method() : DTLS_client_method());
@@ -848,7 +846,6 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
     TLSShared *s = &c->tls_shared;
     int ret;
 
-    av_assert0(s);
     if ((ret = ff_tls_open_underlying(s, h, uri, options)) < 0)
         goto fail;
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-09-18 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175820345145.25.2061279955581888793@463a07221176 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git