Repository navigation
require exact element count in as<std::array<T, N>> - #1203
Merged
Merged
Conversation
Contributor
|
@rajath201, thank you for sending the PR. It looks good to me. appveyor looks still processing but I've comfirmed it successfully finished from the appveyor site. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
as<std::array<T, N>>(include/msgpack/v1/adaptor/cpp11/array.hpp) only rejects wire arrays longer than N.as_implalways reads N elements, so a well-formed array with fewer than N, the empty array included, walkso.via.array.ptr[0..N-1]past the end of the real array, or dereferences a null pointer when the array is empty. Decoding an untrusted msgpack array throughobject::as<std::array<T, N>>()with an element type that has anasadaptor reads out of bounds (ASan SEGV, UBSan non-zero offset to null pointer).Reject any array whose size is not exactly N, the same guard the tuple and fusion readers already carry. The check stays in
asrather than the recursiveas_implso the bound is stated once at the entry point, and theconvertpath is left alone since it only iteratesarray.size. A5 in security_fixes_cpp11.cpp sits next to the existing short-array cases; it faults on the current tree and passes with the fix.