-
Notifications
You must be signed in to change notification settings - Fork 159
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
[Audit fixes] FOR-02: Inconsistent Deserialization of Address ID #1149
Conversation
vm/address/src/lib.rs
Outdated
if to_leb_bytes(id)? == bz { | ||
Ok(id) | ||
} else { | ||
error!( |
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.
Probably makes sense to have this be part of the InvalidAddressIDPayload variant instead of printing it out
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.
Like, maybe using a tuple in the enum variant to capture the id?
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.
Take a look at these changes. Is this what you meant?
2e5f084
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.
👍
@@ -13,6 +13,7 @@ num-derive = "0.3.0" | |||
data-encoding = "2.1.2" | |||
data-encoding-macro = "0.1.7" | |||
leb128 = "0.2.1" | |||
log = "0.4.8" |
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.
Think we can remove this now.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #1134
Other information and links
from_leb_128
is too permissive of how leb128 bytes are deserialized, resulting in inconsistent behavior from how Lotus deserializes bytes. Lotus throws an error if there byte encodings are inconsistent.