-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce size of ArrayView returned by subspan
#1001
Conversation
The size was allowing access of potentially invalid memory.
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! Thank you.
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.
Thanks, Brian.
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.
Thanks for adding this @gunney1
Since you're already touching this function, it might be good to further improve the range checks and tests.
The over-large size was allowing access of potentially invalid memory by the
ArrayView
. This can happen in the object returned byArrayView::subspan
.ArrayView
by the offset amount, to make it NOT okay to access data past the end of the original view.ArrayView
.I added the unit test because
subspan
isn't used anywhere in the library. This change may affect application code that makes use of the buggy feature. The change is indicated in the release notes.