]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: fix Segmentation Fault related to tags. 36085/head
authorzhuo li <lizhuo@chinatelecom.cn>
Sun, 12 Jul 2020 09:31:20 +0000 (17:31 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 14 Jul 2020 03:44:50 +0000 (05:44 +0200)
It is found that rgw crashes when putting a tag beyond the rule to the object, which can be solved by adding the return value judgment.

Fixes: https://tracker.ceph.com/issues/46485
Signed-off-by: zhuo li <lizhuo@chinatelecom.cn>
Signed-off-by: yupeng chen <chenyupeng@chinatelecom.cn>
(cherry picked from commit 5994ec12a7039f21b8f9e1077f2f721003de8cb6)

src/rgw/rgw_lc.cc

index 9a3def0a10822db2f13f44cf231b524dd4aba9cb..dea19cbe33a7c6be4a029f25a4a0e3a653c462e2 100644 (file)
@@ -841,6 +841,8 @@ static inline bool has_all_tags(const lc_op& rule_action,
   for (const auto& tag : object_tags.get_tags()) {
     const auto& rule_tags = rule_action.obj_tags->get_tags();
     const auto& iter = rule_tags.find(tag.first);
+    if(iter == rule_tags.end())
+        continue;
     if(iter->second == tag.second)
     {
       tag_count++;