Improve RTSP server input validation and build configuration#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: feaf46a3ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return -1; | ||
| } | ||
|
|
||
| if (!g_file_test(argv[1], G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { |
There was a problem hiding this comment.
Require regular file when validating input path
g_file_test() treats combined GFileTest flags as an OR, so G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR succeeds for any existing path, including directories. In this case a directory argument bypasses the new guard and the server continues until GStreamer fails at runtime when filesrc tries to open it as a file, which defeats the intended fail-fast validation. Use G_FILE_TEST_IS_REGULAR alone (or separate checks) to enforce a real file.
Useful? React with 👍 / 👎.
Motivation
Makefilelocation and correct minor wording.Description
#include <string.h>and an early check usingg_file_test(argv[1], G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)to fail fast when the media path is missing or not a regular file insrc/rtsp_server.c.g_strescapeand injected the escaped value into the GStreamer launch string, and freed the escaped string afterwards insrc/rtsp_server.c.rtsp_serverand correctedlink_directoriesto useGSTREAMER_LIBRARY_DIRSinCMakeLists.txt.src/inREADME.md.Testing
cmake -S . -B build && cmake --build build, which failed in this environment because theglib-2.0/gobject-2.0development packages are not installed (failure is environmental, not due to the changes).Codex Task