-
Notifications
You must be signed in to change notification settings - Fork 49
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 RolloverCount calculation error #146
Conversation
@cszdlt This is a really great contribution, would you be interested in joining the Pion organization? Would love to know what we could improve, and would love your help. |
I am a beginner with limited ability😅, but I am very happy to be able to help. |
I'll take a look tomorrow. |
Codecov Report
@@ Coverage Diff @@
## master #146 +/- ##
==========================================
+ Coverage 75.56% 76.06% +0.50%
==========================================
Files 16 16
Lines 757 773 +16
==========================================
+ Hits 572 588 +16
Misses 103 103
Partials 82 82
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
context.go
Outdated
roc++ | ||
seq := int32(sequenceNumber) | ||
localRoc := uint32(s.index >> 16) | ||
localSeq := int32(s.index & 0xffff) |
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.
localSeq := int32(s.index & 0xffff) | |
localSeq := int32(s.index & (seqNumMax - 1)) |
just to make it consistent with https://github.com/pion/srtp/pull/146/files#diff-552f47512a00afe5fc6850cc9ddc830a6daeca162750e50aab4ed549685e0253R192
(seqNumMax - 1
is evaluated during compilation)
guessRoc := localRoc | ||
var difference int32 = 0 | ||
|
||
if s.rolloverHasProcessed { |
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.
https://github.com/cisco/libsrtp/blob/bd0f27ec0e299ad101a396dde3f7c90d48efc8fc/crypto/replay/rdbx.c#L309-L325
I think above condition (s.index > seqNumMedian
) should be checked here to avoid wrong guess after initialization and ROC overflow.
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.
Yes, this judgment needs to be added.
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.
@at-wat Sorry, I forgot to run the check script. This is my first PR... T_T
s.index > seqNumMedian
seems have to be checked
20ce78c
to
55d0a2a
Compare
@Sean-Der generate-authors workflow doesn't work for forked PRs since secrets can't be expanded on the forked PRs for security. Also, passing personal access token of the bot to the third-party action is not good at security unless action version is specified by commit hash. |
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.
LGTM, sorry for taking too long.
Mind adding you to AUTHORS.txt by manually running .github/generate-authors.sh script?
it's okay no problem. |
Running GITHUB_WORKSPACE=$(pwd) .github/generate-authors.sh will update AUTHORS.txt based on the commit history. |
The email I set on github is different from my local one, and two entries will be added after running the script... like this:
what should I do? |
will open an editor to select action for each commit. Change
until processing all selected commits. It will update the commit author info to your current git config. |
Or it may be easier to squash all commits in this PR. |
057a9d8
to
f0dcd1c
Compare
Fix Unorder interval exceeds maxROCDisorder causing RolloverCount error.
cce0529
to
8ec90ad
Compare
Is it like this? :) |
Perfect! Thank you so much! |
Description
Fix unorder interval exceeds
maxROCDisorder
causing RolloverCount error.When there is a serious disorder in the network (the disorder segment is greater than
maxROCDisorder
), the nextRolloverCount will be calculated incorrectly.Will cause srtp decryption to fail.This PR fixed this problem.
Imitate
libsrtp/crypto/replay/rdbx.c: srtp_index_guess