]> 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:56:20 +0000 (17:56 +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 24e14e241ee085d6b0ef783c51cb7cdcdb1d1043..a0a225cbf486c5dc47ee2c34eb348d6a2dc94e5c 100644 (file)
@@ -569,13 +569,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++;
     }