8000 api: fix crash in /recordings/list (#4040) by aler9 · Pull Request #4291 · bluenviron/mediamtx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

api: fix crash in /recordings/list (#4040) #4291

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Conversation

aler9
Copy link
Member
@aler9 aler9 commented Feb 28, 2025

Fixes #4040

The API crashed when

  • '%path%' is not present in 'recordPath'
  • 'all_others' is in 'paths'
  • there's at least one recording segment

A recording segment without path is parsed as a segment with an empty path. This path is then passed to FindPathConf(), that returns an error in case of empty or invalid paths. This error is not checked for performance reasons, leading to the crash.

This PR prevents empty or invalid paths from reaching FindPathConf().

Copy link
codecov bot commented Feb 28, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 9 lines in your changes missing coverage. Please review.

Project coverage is 56.64%. Comparing base (95d0be6) to head (ba845af).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/conf/path.go 59.09% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4291      +/-   ##
==========================================
- Coverage   56.66%   56.64%   -0.03%     
==========================================
  Files         203      203              
  Lines       20646    20652       +6     
==========================================
- Hits        11699    11698       -1     
- Misses       8081     8088       +7     
  Partials      866      866              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The API crashed when

- '%path%' is not present in 'recordPath'
- 'all_others' is in 'paths'
- there's at least one recording segment

A recording segment without path is parsed as a segment with an empty
path. This path is then passed to FindPathConf(), that returns an error
in case of empty or invalid paths. This error is not checked for
performance reasons, leading to the crash.

This PR prevents empty or invalid paths from reaching FindPathConf().
@aler9 aler9 force-pushed the fix/api-record-crash branch from fad8c7b to ba845af Compare February 28, 2025 17:56
@aler9 aler9 merged commit 44136b3 into main Feb 28, 2025
8 checks passed
@aler9 aler9 deleted the fix/api-record-crash branch February 28, 2025 18:04
Copy link
Contributor

This issue is mentioned in release v1.12.0 🚀
Check out the entire changelog by clicking here

1 similar comment
Copy link
Contributor

This issue is mentioned in release v1.12.0 🚀
Check out the entire changelog by clicking here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API /v3/recordings/list crashes
1 participant
0