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

Check for bad length in length_protocol #1067

Merged
1 commit merged into from
Nov 18, 2019
Merged

Check for bad length in length_protocol #1067

1 commit merged into from
Nov 18, 2019

Conversation

ghost
Copy link

@ghost ghost commented Oct 18, 2019

closes #1063

@ghost ghost self-requested a review October 18, 2019 21:08
# without overlap into the next packet
if (packet_length * 8) < (@length_bit_offset + @length_bit_size)
raise "Calculated packet length of #{packet_length * 8} bits < (offset:#{@length_bit_offset} + size:#{@length_bit_size})"
end
Copy link
Author

Choose a reason for hiding this comment

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

I think this is a more robust check because the length field should never overlap into the next packet

@codecov-io
Copy link

codecov-io commented Oct 18, 2019

Codecov Report

Merging #1067 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
+ Coverage   84.15%   84.15%   +<.01%     
==========================================
  Files         165      165              
  Lines       15746    15748       +2     
==========================================
+ Hits        13251    13253       +2     
  Misses       2495     2495
Impacted Files Coverage Δ
lib/cosmos/interfaces/protocols/length_protocol.rb 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b10b5f0...aedac44. Read the comment docs.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks like this will nicely resolve the issue.

@ghost ghost merged commit 0d17e39 into master Nov 18, 2019
@ghost ghost deleted the zero_length_protocol branch November 18, 2019 21:40
This pull request was closed.
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.

Length Protocol does not handle 0 length
2 participants