only apply Range to a 206 response in write_content_with_provider - #2510
Open
metsw24-max wants to merge 1 commit into
Open
only apply Range to a 206 response in write_content_with_provider#2510metsw24-max wants to merge 1 commit into
metsw24-max wants to merge 1 commit into
Conversation
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.
Unvalidated Range reaches the content provider on non-2xx responses
write_content_with_providerslices the representation wheneverreq.rangesis non-empty, butapply_rangesonly slices for a 206 anddetail::range_erroronly validates the ranges for a 2xx status, so a handler answering 403 through a content provider hands the client's raw offset straight down (ASAN: heap-buffer-overflow, READ of 201 bytes past a 7-byte buffer, which then goes out on the socket; the bounds asserts inget_range_offset_and_lengthare compiled out under NDEBUG). Gating on 206 to matchapply_rangesalso settles the 2xx-but-not-206 case, where the body written was shorter than the Content-Length already sent, and the added test covers both.