Skip to content

varint_read_u64 panics on unwrap in no_std environment#145

Merged
vmx merged 2 commits intomultiformats:masterfrom
mattheworris:fix-unwrap-panic
Oct 17, 2023
Merged

varint_read_u64 panics on unwrap in no_std environment#145
vmx merged 2 commits intomultiformats:masterfrom
mattheworris:fix-unwrap-panic

Conversation

@mattheworris
Copy link
Copy Markdown
Contributor

The goal of this pull request is to refactor unwrap() to return the u64 value or anError:VarIntDecodeError in the no_std environment.

This error was discovered in fuzz testing.

Tests were refactored to include a new no_std_tests module, in order to test the fix.
cargo test --no-default-features will execute the no_std test.

Copy link
Copy Markdown
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@vmx vmx merged commit 86c7912 into multiformats:master Oct 17, 2023
mattheworris added a commit to frequency-chain/frequency that referenced this pull request Oct 17, 2023
…vironment (#1719)

# Goal
The goal of this PR is to eliminate a panic discovered in fuzz testing.
Closes #1712 
# Discussion
A PR was created in `multiformats/rust-cid` and merged to refactor
`unwrap()` to return a Result in a `no_std` environment.
See PR here:
[multiformats/rust-cid/pull/145](multiformats/rust-cid#145)

`Cargo.toml` was updated to be pinned to the PR commit with the fix in
`rust-cid`

# Checklist
- [ ] Chain spec updated
- [ ] Custom RPC OR Runtime API added/changed? Updated js/api-augment.
- [ ] Design doc(s) updated
- [x] Tests added
- [ ] Benchmarks added
- [ ] Weights updated

---------

Co-authored-by: Matthew Orris <--help>
rustadot pushed a commit to rustadot/recurrency that referenced this pull request Sep 5, 2024
…vironment (#1719)

# Goal
The goal of this PR is to eliminate a panic discovered in fuzz testing.
Closes #1712 
# Discussion
A PR was created in `multiformats/rust-cid` and merged to refactor
`unwrap()` to return a Result in a `no_std` environment.
See PR here:
[multiformats/rust-cid/pull/145](multiformats/rust-cid#145)

`Cargo.toml` was updated to be pinned to the PR commit with the fix in
`rust-cid`

# Checklist
- [ ] Chain spec updated
- [ ] Custom RPC OR Runtime API added/changed? Updated js/api-augment.
- [ ] Design doc(s) updated
- [x] Tests added
- [ ] Benchmarks added
- [ ] Weights updated

---------

Co-authored-by: Matthew Orris <--help>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants