]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: ES sync: wrap all the decode bls in try block 24492/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 9 Oct 2018 11:52:22 +0000 (13:52 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Wed, 10 Oct 2018 13:05:35 +0000 (15:05 +0200)
since decode can throw, wrap all the try block

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_sync_module_es.cc

index 250e33c9d30c9ea4c62f564e4a3eb2fc979f9b3d..c74ca42e39d7cf7e694898764f7d3b8f7cb1f290 100644 (file)
@@ -303,6 +303,7 @@ struct es_obj_metadata {
           decode(policy, i);
         } catch (buffer::error& err) {
           ldout(cct, 0) << "ERROR: failed to decode acl for " << bucket_info.bucket << "/" << key << dendl;
+          continue;
         }
 
         const RGWAccessControlList& acl = policy.get_acl();
@@ -319,12 +320,24 @@ struct es_obj_metadata {
           }
         }
       } else if (attr_name == RGW_ATTR_TAGS) {
-        auto tags_bl = val.cbegin();
-        decode(obj_tags, tags_bl);
+        try {
+          auto tags_bl = val.cbegin();
+          decode(obj_tags, tags_bl);
+        } catch (buffer::error& err) {
+          ldout(cct,0) << "ERROR: failed to decode obj tags for "
+                       << bucket_info.bucket << "/" << key << dendl;
+          continue;
+        }
       } else if (attr_name == RGW_ATTR_COMPRESSION) {
         RGWCompressionInfo cs_info;
-        auto vals_bl = val.cbegin();
-        decode(cs_info, vals_bl);
+        try {
+          auto vals_bl = val.cbegin();
+          decode(cs_info, vals_bl);
+        } catch (buffer::error& err) {
+          ldout(cct,0) << "ERROR: failed to decode compression attr for "
+                       << bucket_info.bucket << "/" << key << dendl;
+          continue;
+        }
         out_attrs.emplace("compression",std::move(cs_info.compression_type));
       } else {
         if (!is_sys_attr(attr_name)) {