Added extra overrun detection in BYTE_ARRAY_LEN decoder. #1981
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Although the input specifies the maximum size of 'out' in *out_side (which is subsequently replaced by the actual size), this wasn't checked for when calling byte_array_len.len_codec->decode to fetch the length field.
The obvious fix did trigger other problems however. We've been routinely calling this with incorrect parameters when decoding aux tags. Eg XA:i encoded as XAs (short) would specify out_size of 1, as we're attempting to decode a single item. This is the standard way all of our decoders work - indicating the number of things to decode rather than their byte lengths. However by definition this is a "byte array" so we need to compensate for that before calling the decode function. It wasn't required before (as we didn't check).