-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: fix read syscall and sdk method #584
Conversation
Stebalien
commented
May 19, 2022
- Return the correct offset (relative to the end of the logical buffer, not relative to the end of the bytes read).
- Don't cast "remaining" to a usize in read_block as it can be negative.
- Add an exhaustive test.
fc36827
to
4f06225
Compare
|
||
#[no_mangle] | ||
pub fn invoke(_: u32) -> u32 { | ||
std::panic::set_hook(Box::new(|info| { |
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.
This just makes debugging a lot easier.
1. Return the correct offset (relative to the end of the logical buffer, not relative to the end of the bytes read). 2. Don't cast "remaining" to a usize in read_block as it can be negative. 3. Add an exhaustive test. Found by @wadealexc.
4f06225
to
7a2671c
Compare
Yeah, that'll give us quite a bit of coverage. But we still need integration tests like this to get syscall (mostly concerning illegal arguments, etc.) and sdk coverage. |
Looks good to me. My one nit is that the I don't think that the cases being covered by these are currently possible, though. |
This costs next to nothing, and is a good safety check.