3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-09 00:35:47 +00:00

fix a couple hundred deref-after-free bugs due to .c_str() on a temporary string

This commit is contained in:
Nuno Lopes 2020-07-11 20:24:45 +01:00
parent 48a9defb0d
commit 23e6adcad3
64 changed files with 248 additions and 229 deletions

View file

@ -215,6 +215,11 @@ struct check_logic::imp {
struct failed {};
std::string m_last_error;
void fail(std::string &&msg) {
m_last_error = std::move(msg);
throw failed();
}
void fail(char const * msg) {
m_last_error = msg;
throw failed();
@ -473,7 +478,7 @@ struct check_logic::imp {
else {
std::stringstream strm;
strm << "logic does not support theory " << m.get_family_name(fid);
fail(strm.str().c_str());
fail(strm.str());
}
}