Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'Handle S3 partial read overflows' from Pavel Emelyanov
The test case that validates upload-sink works does this by getting several random ranges from the uploaded object and checks that the content is what it should be. The range boundaries are generated like this: ``` uint64_t len = random(1, chunk_size); uint64_t offset = random(file_size) - len; ``` The 2nd line is not correct, if random number happens less than the len the offset befomes "negative", i.e. -- very large 64-bit unsigned value. Next, this offset:len gets into s3 client's get_object_contiguous() helper which in turn converts them into http range header's bytes-specifier format which is "first_bytet-last_byte" one. The math here is ``` first_byte = offset; last_byte = offset + len - 1; ``` Here the overflow of the offset thing results in underflow of the last_byte -- it becomes less than the first_byte. According to RFC this range-specifier is invalid and (!) can be ignored by the server. This is what minio does -- it ignores invalid range and returns back full object. But that's not all. When returning object portion the http request status code is PartialContent, but when the range is ignored and full object is returned, the status is OK. This makes s3 client's request fail with unexpected_status_error in the middle of the test. Then the object is removed with deferred action and actual error is printed into logs. In the end of the day logs look as if deletion of an object failed with OK status %) fixes: #16133 Closes #16324 * github.com:scylladb/scylladb: test/s3: Avoid object range overflow s3/client: Handle GET-with-Range overflows correctly
- Loading branch information