]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_crypt: take care of start & end boundaries when parsing range
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 25 Mar 2019 14:24:15 +0000 (15:24 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 1 Apr 2019 15:48:13 +0000 (17:48 +0200)
As http range header is inclusive of start and end ranges, this otherwise breaks
at ranges close to multipart boundaries

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 9c92b56d77932283ccc0336645dc3b76bd0fffa2)

src/rgw/rgw_crypt.cc

index 0c89bdaa8252cf94655cb2ac0b1954161a1034a2..10c9693e1f6eb3796ffca366de4946b69f83fc88 100644 (file)
@@ -667,13 +667,13 @@ int RGWGetObj_BlockDecrypt::fixup_range(off_t& bl_ofs, off_t& bl_end) {
     off_t in_end = bl_end;
 
     size_t i = 0;
-    while (i<parts_len.size() && (in_ofs > (off_t)parts_len[i])) {
+    while (i<parts_len.size() && (in_ofs >= (off_t)parts_len[i])) {
       in_ofs -= parts_len[i];
       i++;
     }
     //in_ofs is inside block i
     size_t j = 0;
-    while (j<parts_len.size() && (in_end > (off_t)parts_len[j])) {
+    while (j<parts_len.size() && (in_end >= (off_t)parts_len[j])) {
       in_end -= parts_len[j];
       j++;
     }