From: Abhishek Lekshmanan Date: Tue, 9 Oct 2018 11:52:22 +0000 (+0200) Subject: rgw: ES sync: wrap all the decode bls in try block X-Git-Tag: v12.2.11~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=43b01649463df81e2257c41ecc9cbef020690c51;p=ceph.git rgw: ES sync: wrap all the decode bls in try block since decode can throw, wrap all the try block Signed-off-by: Abhishek Lekshmanan (cherry picked from commit 12b12ccea23871688cc4101c72f00b0575f1c01a) Conflicts: src/rgw/rgw_sync_module_es.cc: using ::encode/::decode --- diff --git a/src/rgw/rgw_sync_module_es.cc b/src/rgw/rgw_sync_module_es.cc index 0d5a4648939d..aa58219b5a9c 100644 --- a/src/rgw/rgw_sync_module_es.cc +++ b/src/rgw/rgw_sync_module_es.cc @@ -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)) {