Skip to content
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

Merged
merged 3 commits into from
Oct 28, 2020

Conversation

isnumanagic
Copy link
Contributor

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.

@januscla
Copy link

Thanks for your contribution, @isnumanagic! Please make sure you sign our CLA, as it's a required step before we can merge this.

Copy link
Member

@lminiero lminiero left a 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.

@@ -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) {
Copy link
Member

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).

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
Copy link
Member

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).

@lminiero
Copy link
Member

Thanks for the quick fixes! I'll make a few tests with existing recordings, and if everything goes well I'll merge 👍

@lminiero
Copy link
Member

Looks good, merging, thanks again 👍

@lminiero lminiero merged commit 1066bd9 into meetecho:master Oct 28, 2020
@isnumanagic isnumanagic deleted the pp-rtp-header-buffer-fix branch October 28, 2020 11:40
PauKerr pushed a commit to caffeinetv/janus-gateway that referenced this pull request Nov 11, 2020
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.

3 participants