From: Brad Hubbard Date: Thu, 10 Mar 2016 05:41:39 +0000 (+1000) Subject: crushtool: Don't crash when called on a file that isn't a crushmap X-Git-Tag: v10.1.1~107^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7663b9f09198c52b9cb1288e7dd8ae762662673a;p=ceph.git crushtool: Don't crash when called on a file that isn't a crushmap Fixes: #8286 Signed-off-by: Brad Hubbard --- diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index 5d2d542066a..7e0438972c5 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -583,7 +583,12 @@ int main(int argc, const char **argv) } } bufferlist::iterator p = bl.begin(); - crush.decode(p); + try { + crush.decode(p); + } catch(...) { + cerr << me << ": unable to decode " << infn << std::endl; + exit(EXIT_FAILURE); + } } if (compile) {