Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] Small RTSP fixes (PR #20541)
@ 2025-09-17 13:34 Marvin Scholz via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Marvin Scholz via ffmpeg-devel @ 2025-09-17 13:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marvin Scholz

PR #20541 opened by Marvin Scholz (ePirat)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20541
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20541.patch

- Fix leading space in the RTSP reason string
- Avoid logging invalid values and instead properly log warnings on failure reading RTSP data


>From f6d11e63faaa7aaadd1e27a18a96a65581f50a34 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Fri, 22 Aug 2025 16:50:34 +0200
Subject: [PATCH 1/2] avformat/rtsp: do not log invalid values

When reading fails the first time, ch would be uninitialized and
printed in the log message. Instead check for an error early and
log it properly.
---
 libavformat/rtsp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 10355b89b8..13507d1858 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1239,9 +1239,12 @@ start:
         q = buf;
         for (;;) {
             ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
+            if (ret != 1) {
+                ret = (ret < 0) ? ret : AVERROR(EIO);
+                av_log(s, AV_LOG_WARNING, "Failed reading RTSP data: %s\n", av_err2str(ret));
+                return ret;
+            }
             av_log(s, AV_LOG_TRACE, "ret=%d c=%02x [%c]\n", ret, ch, ch);
-            if (ret != 1)
-                return ret < 0 ? ret : AVERROR(EIO);
             if (ch == '\n')
                 break;
             if (ch == '$' && q == buf) {
-- 
2.49.1


>From 614a5682ec349a1ca3daba19613ae93343932e08 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Fri, 22 Aug 2025 21:41:26 +0200
Subject: [PATCH 2/2] avformat/rtsp: fix leading space in RTSP reason

When parsing the RTSP message reason, the whole remainder
after parsing the status code was used, which would lead to
a leading space in the parsed reason string.
---
 libavformat/rtsp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 13507d1858..d601d63a89 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1274,6 +1274,7 @@ start:
             if (!strncmp(buf1, "RTSP/", 5)) {
                 get_word(buf1, sizeof(buf1), &p);
                 reply->status_code = atoi(buf1);
+                p += strspn(p, SPACE_CHARS);
                 av_strlcpy(reply->reason, p, sizeof(reply->reason));
             } else {
                 av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method
-- 
2.49.1

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-17 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-17 13:34 [FFmpeg-devel] [PATCH] Small RTSP fixes (PR #20541) Marvin Scholz via ffmpeg-devel

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