3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

don't crash in Z3_model_eval API if not given a valid expression

Signed-off-by: Nuno Lopes <nlopes@microsoft.com>
This commit is contained in:
Nuno Lopes 2015-06-26 18:33:13 +01:00
parent e81dc5a0a0
commit 3104d2954c
3 changed files with 3 additions and 4 deletions

View file

@ -664,12 +664,9 @@ extern "C" {
Z3_TRY;
LOG_Z3_get_bool_value(c, a);
RESET_ERROR_CODE();
CHECK_IS_EXPR(a, Z3_L_UNDEF);
ast_manager & m = mk_c(c)->m();
ast * n = to_ast(a);
if (!is_expr(n)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return Z3_L_UNDEF;
}
if (m.is_true(to_expr(n)))
return Z3_L_TRUE;
if (m.is_false(to_expr(n)))