]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: ES sync: wrap all the decode bls in try block 27972/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 9 Oct 2018 11:52:22 +0000 (13:52 +0200)
committerNathan Cutler <ncutler@suse.com>
Mon, 6 May 2019 10:28:22 +0000 (12:28 +0200)
since decode can throw, wrap all the try block

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

Conflicts:
src/rgw/rgw_sync_module_es.cc
- mimic uses val.begin() where master has val.cbegin()

src/rgw/rgw_sync_module_es.cc

index 9283d5336cd8b528ec0fd0a167a7cd05407e487d..b6162c1c569ad2c85922b0bdfff58d3ebb83d551 100644 (file)
@@ -480,6 +480,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();
@@ -496,12 +497,24 @@ struct es_obj_metadata {
           }
         }
       } else if (attr_name == RGW_ATTR_TAGS) {
-        auto tags_bl = val.begin();
-        decode(obj_tags, tags_bl);
+        try {
+          auto tags_bl = val.begin();
+          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.begin();
-        decode(cs_info, vals_bl);
+        try {
+          auto vals_bl = val.begin();
+          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)) {