rgw: fix crash when listing objects via swift

Fixes: http://tracker.ceph.com/issues/19249

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2017-03-08 14:52:34 -08:00
parent 515db13970
commit a9ec5e8ce1

View File

@ -283,15 +283,18 @@ void RGWListBucket_ObjStore_SWIFT::send_response()
while (iter != objs.end() || pref_iter != common_prefixes.end()) {
bool do_pref = false;
bool do_objs = false;
rgw_obj_key key(iter->key);
rgw_obj_key key;
if (iter != objs.end()) {
key = iter->key;
}
if (pref_iter == common_prefixes.end())
do_objs = true;
else if (iter == objs.end())
do_pref = true;
else if (key.name.compare(pref_iter->first) == 0) {
else if (!key.empty() && key.name.compare(pref_iter->first) == 0) {
do_objs = true;
++pref_iter;
} else if (key.name.compare(pref_iter->first) <= 0)
} else if (!key.empty() && key.name.compare(pref_iter->first) <= 0)
do_objs = true;
else
do_pref = true;