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

enhance indexing and arithmetic safety #22

Closed
ralexstokes opened this issue Aug 23, 2022 · 3 comments
Closed

enhance indexing and arithmetic safety #22

ralexstokes opened this issue Aug 23, 2022 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@ralexstokes
Copy link
Owner

analogues of these:

ralexstokes/ethereum-consensus#151

ralexstokes/ethereum-consensus#152

for this repo :)

@claravanstaden
Copy link
Contributor

Hey @ralexstokes! As part of our production readiness of https://github.com/Snowfork/snowbridge I will be taking a look at these.

@ralexstokes ralexstokes added this to the v1.0.0 milestone Jan 13, 2023
@ralexstokes ralexstokes added the enhancement New feature or request label Jan 13, 2023
@ralexstokes ralexstokes removed this from the v1.0.0 milestone Feb 5, 2023
@ralexstokes
Copy link
Owner Author

ralexstokes commented Apr 15, 2023

@0xTylerHolmes found a panic here :)

use ssz_rs::prelude::*;

type Bar = Vector<u8, 96>;

#[derive(PartialEq, Eq, Debug, Default, Clone, SimpleSerialize)]
pub struct Foo {
    pub bar: Bar,
}

fn main() {
    let data = vec![];
    let foo = Foo::deserialize(&data);
    dbg!(foo);
}

and what fails is this: https://github.com/ralexstokes/ssz-rs/blob/main/ssz-rs-derive/src/lib.rs#L202 where the range on encoding hits out of bounds

instead, we should use https://doc.rust-lang.org/std/vec/struct.Vec.html#method.get

and note to whoever fixes this: we should also review all of the direct indexing ops and switch to get

@ralexstokes
Copy link
Owner Author

this should be addressed by all of the work linked here once #57 is merged

great work everyone and thank you all SO much for improving this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants