-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add check for deserialising hex values over U256 limit #11309
Add check for deserialising hex values over U256 limit #11309
Conversation
Update spec.json field to match test name.
It looks like @lewisbelcher hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io Once you've signed, please reply to this thread with Many thanks, Parity Technologies CLA Bot |
[clabot:check] |
It looks like @lewisbelcher signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
@niklasad1 I can't seem to add reviewers/labels, but could you take a look? Given that slicing the string to |
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.
Looks good, many thanks.
Could you add tests that exercise the various failure modes and check that the errors match what we expect?
Co-Authored-By: David <dvdplm@gmail.com>
Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
The test |
The test `uint_deserialization_error_for_hex_too_large` sufficiently covers the need for this test.
…sbelcher/parity-ethereum into check-hex-length-before-deserialise
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.
Nice, thank you.
@@ -120,6 +125,7 @@ pub fn validate_optional_non_zero<'de, D>(d: D) -> Result<Option<Uint>, D::Error | |||
mod test { | |||
use super::Uint; | |||
use ethereum_types::U256; | |||
use serde_json::error::Category; |
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.
use serde_json::error::Category; |
Add a length check to return appropriate error when attempting to deserialise hex values over the U256 limit.
Fixes #11268