Skip to content

Improve RTSP server input validation and build configuration#1

Open
ptamb3 wants to merge 1 commit into
mainfrom
codex/review-the-code
Open

Improve RTSP server input validation and build configuration#1
ptamb3 wants to merge 1 commit into
mainfrom
codex/review-the-code

Conversation

@ptamb3

@ptamb3 ptamb3 commented Feb 26, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Harden startup behavior by validating the provided media path and avoiding embedding unescaped paths into the GStreamer pipeline.
  • Fix CMake metadata and linking variables to match expected project layout and GStreamer pkg-config variables.
  • Clarify README instructions to avoid confusion about the Makefile location and correct minor wording.

Description

  • Added #include <string.h> and an early check using g_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 in src/rtsp_server.c.
  • Escaped and quoted the media path with g_strescape and injected the escaped value into the GStreamer launch string, and freed the escaped string afterwards in src/rtsp_server.c.
  • Renamed the CMake project to rtsp_server and corrected link_directories to use GSTREAMER_LIBRARY_DIRS in CMakeLists.txt.
  • Fixed README wording and clarified that the Makefile build flow lives in src/ in README.md.

Testing

  • Attempted to configure and build with cmake -S . -B build && cmake --build build, which failed in this environment because the glib-2.0/gobject-2.0 development packages are not installed (failure is environmental, not due to the changes).
  • No unit tests are present in the repository and no additional automated tests were executed.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/rtsp_server.c
return -1;
}

if (!g_file_test(argv[1], G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant