diff --git a/src/grey.cpp b/src/grey.cpp index fa8da2b4..86a93d25 100644 --- a/src/grey.cpp +++ b/src/grey.cpp @@ -198,7 +198,15 @@ void applyGreyOverrides(Grey *g, const string &s) { string::const_iterator ve = find(ke, pe, ';'); - unsigned int value = lexical_cast(string(ke + 1, ve)); + unsigned int value = 0; + try { + value = lexical_cast(string(ke + 1, ve)); + } catch (boost::bad_lexical_cast &e) { + printf("Invalid grey override key %s:%s\n", key.c_str(), + string(ke + 1, ve).c_str()); + invalid_key_seen = true; + break; + } bool done = false; /* surely there exists a nice template to go with this macro to make diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp index fecdd330..de9fde07 100644 --- a/tools/hsbench/main.cpp +++ b/tools/hsbench/main.cpp @@ -1065,6 +1065,9 @@ int HS_CDECL main(int argc, char *argv[]) { } catch (const SqlFailure &f) { cerr << f.message << '\n'; return -1; + } catch (const std::runtime_error &e) { + cerr << "Internal error: " << e.what() << '\n'; + return -1; } return 0;