]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_compression.cc
update sources to v12.1.0
[ceph.git] / ceph / src / rgw / rgw_compression.cc
index 44ed15fbf4df058e0a80a46b8c4469d1657b562d..82acf92bff225b2ade664ddd12fced63a4819bf6 100644 (file)
@@ -76,17 +76,18 @@ int RGWGetObj_Decompress::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len
     lderr(cct) << "Cannot load compressor of type " << cs_info->compression_type << dendl;
     return -EIO;
   }
-  bufferlist out_bl, in_bl;
+  bufferlist out_bl, in_bl, temp_in_bl;
+  bl.copy(bl_ofs, bl_len, temp_in_bl); 
   bl_ofs = 0;
   if (waiting.length() != 0) {
     in_bl.append(waiting);
-    in_bl.append(bl);        
+    in_bl.append(temp_in_bl);        
     waiting.clear();
   } else {
-    in_bl.claim(bl);
+    in_bl.claim(temp_in_bl);
   }
   bl_len = in_bl.length();
-  
+
   while (first_block <= last_block) {
     bufferlist tmp, tmp_out;
     int ofs_in_bl = first_block->new_ofs - cur_ofs;
@@ -130,7 +131,7 @@ int RGWGetObj_Decompress::fixup_range(off_t& ofs, off_t& end)
       vector<compression_block>::iterator fb, lb;
       // not bad to use auto for lambda, I think
       auto cmp_u = [] (off_t ofs, const compression_block& e) { return (unsigned)ofs < e.old_ofs; };
-      auto cmp_l = [] (const compression_block& e, off_t ofs) { return e.old_ofs < (unsigned)ofs; };
+      auto cmp_l = [] (const compression_block& e, off_t ofs) { return e.old_ofs <= (unsigned)ofs; };
       fb = upper_bound(cs_info->blocks.begin()+1,
                        cs_info->blocks.end(),
                        ofs,
@@ -150,7 +151,7 @@ int RGWGetObj_Decompress::fixup_range(off_t& ofs, off_t& end)
   q_len = end - last_block->old_ofs + 1;
 
   ofs = first_block->new_ofs;
-  end = last_block->new_ofs + last_block->len;
+  end = last_block->new_ofs + last_block->len - 1;
 
   first_data = true;
   cur_ofs = ofs;