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

protocols/kad: Fix right shift overflow panic in record_received #1492

Merged
merged 7 commits into from
Mar 18, 2020

Commits on Mar 11, 2020

  1. Configuration menu
    Copy the full SHA
    e6a57ba View commit details
    Browse the repository at this point in the history
  2. protocols/kad: Fix right shift overflow panic in record_received

    Within `Behaviour::record_received` the exponentially decreasing
    expiration based on the distance to the target for a record is
    calculated as following:
    
    1. Calculate the amount of nodes between us and the record key beyond
    the k replication constant as `n`.
    
    2. Shift the configured record time-to-live `n` times to the right to
    calculate an exponentially decreasing expiration.
    
    The configured record time-to-live is a u64. If `n` is larger or equal
    to 64 the right shift will lead to an overflow which panics in debug
    mode.
    
    This patch uses a checked right shift instead, defaulting to 0 (`now +
    0`) for the expiration on overflow.
    mxinden committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    aaaec36 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2020

  1. Configuration menu
    Copy the full SHA
    a3271c2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b08f509 View commit details
    Browse the repository at this point in the history

Commits on Mar 16, 2020

  1. protocols/kad: Extract shifting logic and rework test

    Extract right shift into isolated function and replace complex
    regression test with small isolated one.
    mxinden committed Mar 16, 2020
    Configuration menu
    Copy the full SHA
    9e27e25 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2020

  1. Configuration menu
    Copy the full SHA
    36f6b93 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2020

  1. Configuration menu
    Copy the full SHA
    ccdf994 View commit details
    Browse the repository at this point in the history