Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Ensure bad datastream cannot cause problems2 #888

Closed

Conversation

gilescope
Copy link
Contributor

Is decode_and_advance_with_depth_limit guaranteed to always consume some of the input? I feel like we should do the same as #701 and add a guard and fail if the buffer was not reduced in size to be on the safe side (or failing that make it clear in the doc of that function that it must uphold that invariant).

(if let has been turned into a match and guard if remaining_fragments.len() < last_remaining_fragments.len() added.)

@gilescope gilescope added A0-pleasereview B0-silent Changes should not be mentioned in any release notes labels Jan 5, 2022
@bkchr
Copy link
Member

bkchr commented Jan 5, 2022

Yes it is guaranteed to always consume the input, otherwise it would not have decoded anything.

@bkchr
Copy link
Member

bkchr commented Jan 5, 2022

Maybe you could just read the docs of scale codec?

@bkchr
Copy link
Member

bkchr commented Jan 5, 2022

#701 wasn't correct, see #889

This pr is also not required, because we consume the input here and if there is an error we handle that properly.

@bkchr bkchr closed this Jan 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants