Skip to content

Check data length it RTP ExtHdr handlers#363

Merged
sirzooro merged 1 commit into
pion:mainfrom
sirzooro:rtp_ext_len_check
Jul 3, 2026
Merged

Check data length it RTP ExtHdr handlers#363
sirzooro merged 1 commit into
pion:mainfrom
sirzooro:rtp_ext_len_check

Conversation

@sirzooro

Copy link
Copy Markdown
Contributor

Added data length checks to OneByteHeaderExtension, TwoByteHeaderExtension and RawExtension to prevent panics. They are probably not used by pion itself (did not check all packages here), so fix is just in case someone else still uses them.

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.97674% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.75%. Comparing base (ac0f586) to head (15610c9).

Files with missing lines Patch % Lines
header_extension.go 6.97% 20 Missing and 20 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
- Coverage   82.68%   81.75%   -0.94%     
==========================================
  Files          28       28              
  Lines        3448     3491      +43     
==========================================
+ Hits         2851     2854       +3     
- Misses        427      447      +20     
- Partials      170      190      +20     
Flag Coverage Δ
go 81.75% <6.97%> (-0.94%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sirzooro sirzooro requested a review from JoTurk June 21, 2026 13:04
@sirzooro

Copy link
Copy Markdown
Contributor Author

@JoTurk do we still need OneByteHeaderExtension, TwoByteHeaderExtension and RawExtension? I wonder if we could mark them as deprecated and remove in next major version.

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see many issues with these extensions but they are all pre existing sorry for taking time with the review.
I think we shouldn't remove them either since we're making this library a genetic rtp library

Comment thread header_extension.go
Comment on lines +89 to +91
if len(e.payload) < 4 {
return nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a shame that we can't return an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah. We could change this in RTP/v3. I will add comment there.

Added data length checks to OneByteHeaderExtension,
TwoByteHeaderExtension and RawExtension to prevent panics. They are
probably not used by pion itself, so fix is just in case someone else
still uses them.
@sirzooro sirzooro force-pushed the rtp_ext_len_check branch from 668ac70 to 15610c9 Compare July 3, 2026 05:45
@sirzooro sirzooro merged commit 0f341d6 into pion:main Jul 3, 2026
17 of 18 checks passed
@sirzooro sirzooro deleted the rtp_ext_len_check branch July 3, 2026 05:47
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.

2 participants