You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This From implementation must be replaced with TryFrom or made infallible. Additionally there is an instance of .unwrap() in From<&'static str> for each hash type.
These types originate from parity bitcoin. I believe the macros for implementing these are implementing far more types than we utilize. We should consider minimizing the use of this hash module.
The text was updated successfully, but these errors were encountered:
We now enforce fixed-length byte arrays instead of indexing slices.
This prevents unhandled panics when incoming slices are too short.
- Replaced slice indexing with safe fixed-size array creation.
- Removed methods that relied on unchecked slice indexing.
- Ensured each code path now handles invalid lengths gracefully.
Closes#2275
We now enforce fixed-length byte arrays instead of indexing slices.
This prevents unhandled panics when incoming slices are too short.
- Replaced slice indexing with safe fixed-size array creation.
- Removed methods that relied on unchecked slice indexing.
- Ensured each code path now handles invalid lengths gracefully.
Closes#2275
Types such as H256 and H264 have methods that can cause a runtime panic.
This is due to Indexing into a slice without first checking the size of the slice:
komodo-defi-framework/mm2src/mm2_bitcoin/primitives/src/hash.rs
Line 45 in 4d0f812
ex:
panicked at 'range end index 33 out of range for slice of length 1', mm2src/mm2_bitcoin/primitives/src/hash.rs:157:1
culprit:
https://github.com/KomodoPlatform/komodo-defi-framework/blob/4d0f812ac5089364de51f896e282c419019ac4f9/mm2src/mm2_bitcoin/primitives/src/hash.rs#L42C1-L48C10
https://github.com/KomodoPlatform/komodo-defi-framework/blob/4d0f812ac5089364de51f896e282c419019ac4f9/mm2src/mm2_bitcoin/rpc/src/v1/types/hash.rs#L34C1-L39C10
This From implementation must be replaced with TryFrom or made infallible. Additionally there is an instance of
.unwrap()
inFrom<&'static str>
for each hash type.These types originate from parity bitcoin. I believe the macros for implementing these are implementing far more types than we utilize. We should consider minimizing the use of this hash module.
The text was updated successfully, but these errors were encountered: