-
Notifications
You must be signed in to change notification settings - Fork 92
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
Height::from_str
accepts invalid heights
#752
Comments
I believe you are intentionally creating errors, or in other words, you think there might be incorrect usage in the code. |
yeah, which is why parse returns an error; it should only return Ok if the provided string is valid; otherwise it is unusable for untrusted inputs, which parse is ToStr is intended for. |
Also, the use of indexing causes a panic if there is no "1".parse::<ibc::Height>();
"".parse::<ibc::Height>();
|
I want to know where this input can be generated. |
This is public api in a published library. Where the input is generated is irrelevant. |
@benluelo much appreciated for bringing this up. This is very true! |
Bug Summary
Height::from_str
accepts invalid heights. The implementation should usesplit_once
instead of split:https://github.com/cosmos/ibc-rs/blob/main/crates/ibc/src/core/ics02_client/height.rs#L174-L197
Details
Version
latest main.
The text was updated successfully, but these errors were encountered: