From 748b50c08cfbae835b790b27a7b439ead1768883 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 25 Sep 2018 22:10:12 +1000 Subject: [PATCH] Fix bit shift function in attestation validation --- .../attestation_record/validation/attestation_validation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lighthouse/state/attestation_record/validation/attestation_validation.rs b/lighthouse/state/attestation_record/validation/attestation_validation.rs index 0d20bb466..be2885fcd 100644 --- a/lighthouse/state/attestation_record/validation/attestation_validation.rs +++ b/lighthouse/state/attestation_record/validation/attestation_validation.rs @@ -49,8 +49,8 @@ fn bytes_for_bits(bits: usize) -> usize { } fn any_of_last_n_bits_are_set(byte: &u8, n: usize) -> bool { - let shift = 8_u8.saturating_sub(n as u8); - ((!0 >> shift) & byte) > 0 + let shift = 8_u16.saturating_sub(n as u16); + ((!0 << shift) & u16::from(*byte)) > 0 } pub fn validate_attestation(a: &AttestationRecord,