]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: ES sync: wrap all the decode bls in try block 25444/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 9 Oct 2018 11:52:22 +0000 (13:52 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 7 Dec 2018 15:35:53 +0000 (16:35 +0100)
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:
using ::encode/::decode

src/rgw/rgw_sync_module_es.cc

index 0d5a4648939d0a9fccb7837a77f1875b8c9546ff..aa58219b5a9c2f66912b31299723fb77b54bb544 100644 (file)
@@ -302,6 +302,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();
@@ -318,12 +319,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.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.cbegin();
-        ::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)) {