3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-10 13:10:50 +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

@ -17,6 +17,7 @@ Revision History:
--*/
#pragma once
#include <string>
#include "ast/ast.h"
@ -53,6 +54,7 @@ namespace format_ns {
family_id get_format_family_id(ast_manager & m);
format * mk_string(ast_manager & m, char const * str);
static inline format * mk_string(ast_manager & m, const std::string & str) { return mk_string(m, str.c_str()); }
format * mk_int(ast_manager & m, int i);
format * mk_unsigned(ast_manager & m, unsigned u);
format * mk_indent(ast_manager & m, unsigned i, format * f);
@ -104,6 +106,12 @@ namespace format_ns {
mk_string(m, rp)))));
}
template<typename It, typename ToDoc>
static inline format * mk_seq1(ast_manager & m, It const & begin, It const & end, ToDoc proc, const std::string &header,
char const * lp = "(", char const * rp = ")") {
return mk_seq1(m, begin, end, proc, header.c_str(), lp, rp);
}
#define FORMAT_DEFAULT_INDENT 2
/**