From: Sage Weil Date: Tue, 23 May 2017 17:50:06 +0000 (-0400) Subject: crush/CrushWrapper: fix has_incompat_choose_args() X-Git-Tag: v12.1.0~10^2~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F15244%2Fhead;p=ceph.git crush/CrushWrapper: fix has_incompat_choose_args() Special case empty and return false. Otherwise the rest of the method will dereference an invalid iterator on an empty choose_args map. Fixes broken fix in b1e4295570b6af4d844cf3ec55d77f5c287b29e6. Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 14707f9a36e..a23b3cf6767 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -112,6 +112,8 @@ bool CrushWrapper::has_choose_args() const bool CrushWrapper::has_incompat_choose_args() const { + if (choose_args.empty()) + return false; if (choose_args.size() > 1) return true; crush_choose_arg_map arg_map = choose_args.begin()->second;