[ffmpeg] branch master updated. e63e040f0c avformat/rtsp: fix leading space in RTSP reason
The branch, master has been updated via e63e040f0cef2d6af2fb57aefa6250fc450fa049 (commit) via 2ed47ab72509bbee60288d245a0aebb7eb05e41a (commit) from 899e497122f793c3d97f5aac7bee62567f23fe29 (commit) - Log ----------------------------------------------------------------- commit e63e040f0cef2d6af2fb57aefa6250fc450fa049 Author: Marvin Scholz <epirat07@gmail.com> AuthorDate: Fri Aug 22 21:41:26 2025 +0200 Commit: Marvin Scholz <epirat07@gmail.com> CommitDate: Tue Sep 23 21:33:37 2025 +0000 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. 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 commit 2ed47ab72509bbee60288d245a0aebb7eb05e41a Author: Marvin Scholz <epirat07@gmail.com> AuthorDate: Fri Aug 22 16:50:34 2025 +0200 Commit: Marvin Scholz <epirat07@gmail.com> CommitDate: Tue Sep 23 21:33:37 2025 +0000 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. 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) { ----------------------------------------------------------------------- Summary of changes: libavformat/rtsp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) hooks/post-receive --
participants (1)
-
ffmpeg-git@ffmpeg.org