Skip to content

Commit c0de491

Browse files
committed
another concern case
1 parent 982fcce commit c0de491

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/s3_meta_request.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,8 +1387,8 @@ static int s_s3_meta_request_incoming_headers(
13871387
request->request_type == AWS_S3_REQUEST_TYPE_GET_OBJECT) {
13881388
uint64_t object_range_start = 0;
13891389
uint64_t object_range_end = 0;
1390-
if (aws_s3_parse_content_range_cursor(
1391-
*value, &object_range_start, &object_range_end, NULL /*Object Size*/)) {
1390+
uint64_t object_size = 0;
1391+
if (aws_s3_parse_content_range_cursor(*value, &object_range_start, &object_range_end, &object_size)) {
13921392
AWS_LOGF_ERROR(
13931393
AWS_LS_S3_META_REQUEST,
13941394
"id=%p: Could not parse content range header (%s)",
@@ -1398,7 +1398,12 @@ static int s_s3_meta_request_incoming_headers(
13981398
} else {
13991399
if (request->part_range_end != 0) {
14001400
AWS_FATAL_ASSERT(request->part_range_start == object_range_start);
1401-
AWS_FATAL_ASSERT(request->part_range_end == object_range_end);
1401+
if (request->part_range_end != object_range_end) {
1402+
/* In the case where the object size is less than the range requested, it will return the bytes
1403+
* to the object size. Range is inclusive */
1404+
AWS_FATAL_ASSERT(object_range_start + object_size - 1 == object_range_end);
1405+
AWS_FATAL_ASSERT(request->part_range_end > object_range_end);
1406+
}
14021407
}
14031408
}
14041409
}

0 commit comments

Comments
 (0)