-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix RTP header buffer read #2411
Fix RTP header buffer read #2411
Conversation
Thanks for your contribution, @isnumanagic! Please make sure you sign our CLA, as it's a required step before we can merge this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We did indeed not take too many extensions into account at the time, and I agree your approach handles this better. I just added a couple of notes on code style inline, to make it more consistent with the rest of the project.
postprocessing/janus-pp-rec.c
Outdated
@@ -727,13 +727,31 @@ int main(int argc, char *argv[]) | |||
JANUS_LOG(LOG_VERB, " -- -- Skipping CSRC list\n"); | |||
skip += rtp->csrccount*4; | |||
} | |||
if (rtp->csrccount || rtp->extension) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style: no space between if
and (
(there's a few occurrences of this).
postprocessing/janus-pp-rec.c
Outdated
JANUS_LOG(LOG_WARN, "Missing RTP packet header data (%d instead %"SCNu16")\n", | ||
rtp_header_len+bytes, rtp_header_len+rtp_read_n); | ||
break; | ||
} else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style: the other condition of the else
also should have a bracket, even of the action is simple (makes the code more readable and less ambiguous).
Thanks for the quick fixes! I'll make a few tests with existing recordings, and if everything goes well I'll merge 👍 |
Looks good, merging, thanks again 👍 |
This PR fixes short RTP header buffer in postprocessing module.
Currently, only first 24 bytes of RTP packet are read into buffer, which can omit some/all extension header data, or, in worse case, cause extension header corruption (which is how I found this bug). This fix reads in remaining header bytes into buffer after reading csrc count and extension header length.