3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-11 20:21:25 +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

@ -422,7 +422,7 @@ namespace datalog {
if (!e) {
std::stringstream name_stm;
name_stm << '#' << arg_index;
return symbol(name_stm.str().c_str());
return symbol(name_stm.str());
}
SASSERT(arg_index < e->get_data().m_value.size());
return e->get_data().m_value[arg_index];
@ -1183,11 +1183,11 @@ namespace datalog {
out << " :named ";
while (fresh_names.contains(nm)) {
std::ostringstream s;
s << nm << "!";
nm = symbol(s.str().c_str());
s << nm << '!';
nm = symbol(s.str());
}
fresh_names.add(nm);
display_symbol(out, nm) << ")";
display_symbol(out, nm) << ')';
}
out << ")\n";
}