-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add a limit of number of bytes while scale decoding a slice (#3733)
While scale decoding we first read the length of bytes to decode and then we decode that many bytes. Someone could ask us to decode some malicious bytes such that the read length is unreasonably big. In such case, we would have to create a byte slice as big as the length. The length in byte slice is an encoded as `Compact<u32>`. Current we are just reading length as uint and not checking if it goes beyond the bounds of uint32. So, we would either panic because of `makeslice: len out of range` or because the asked length would be more than the memory we have available in our machine. We are going to put a check to makes sure that this length is less than max of uint32.
- Loading branch information
1 parent
f5b9c4c
commit 5edbf89
Showing
4 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters