From: Abhishek Lekshmanan Date: Mon, 25 Mar 2019 14:24:15 +0000 (+0100) Subject: rgw_crypt: take care of start & end boundaries when parsing range X-Git-Tag: v14.2.1~86^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2624d4e9e56bf9395853215671d760fbb26a6d4a;p=ceph.git rgw_crypt: take care of start & end boundaries when parsing range 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 (cherry picked from commit 9c92b56d77932283ccc0336645dc3b76bd0fffa2) --- diff --git a/src/rgw/rgw_crypt.cc b/src/rgw/rgw_crypt.cc index 24e14e241ee08..a0a225cbf486c 100644 --- a/src/rgw/rgw_crypt.cc +++ b/src/rgw/rgw_crypt.cc @@ -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 (off_t)parts_len[i])) { + while (i= (off_t)parts_len[i])) { in_ofs -= parts_len[i]; i++; } //in_ofs is inside block i size_t j = 0; - while (j (off_t)parts_len[j])) { + while (j= (off_t)parts_len[j])) { in_end -= parts_len[j]; j++; }