Skip to content

Commit

Permalink
rgw: ES sync: wrap all the decode bls in try block
Browse files Browse the repository at this point in the history
since decode can throw, wrap all the try block

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
  • Loading branch information
theanalyst committed Oct 10, 2018
1 parent 3e385c4 commit 12b12cc
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/rgw/rgw_sync_module_es.cc
Expand Up @@ -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();
Expand All @@ -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)) {
Expand Down

0 comments on commit 12b12cc

Please sign in to comment.