From: Jérémie Astor Date: Sun, 12 Jul 2020 17:35:37 +0000 (+0200) Subject: :art: headers and traverse security X-Git-Tag: nightly~1439 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e59402d206ec6782907fa90ae20da16e610d9239;p=gwion.git :art: headers and traverse security --- diff --git a/include/parse.h b/include/parse.h index 06151839..8df27eb7 100644 --- a/include/parse.h +++ b/include/parse.h @@ -91,4 +91,6 @@ __attribute__((returns_nonnull)) ANN Type get_type(const Type t); ANN m_bool check_subscripts(const Env, const Array_Sub, const m_bool is_decl); ANN m_bool check_implicit(const Env env, const Exp e, const Type t); +ANN m_bool ensure_traverse(const Env env, const Type t); +ANN m_bool check_traverse_fdef(const Env env, const Func_Def fdef); #endif diff --git a/src/lib/ptr.c b/src/lib/ptr.c index e2cc692a..fc931530 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -57,7 +57,7 @@ static OP_CHECK(opck_ptr_cast) { DECL_ON(const Type, t, = known_type(env, cast->td)) // was type_decl_resolve const Type _t = get_type(t); if(_t->e->def && !GET_FLAG(_t, check)) - CHECK_BN(traverse_class_def(env, _t->e->def)) + CHECK_BN(ensure_traverse(env, _t)) const Type to = known_type(env, cast->td->types->td); if(isa(cast->exp->info->type, to) > 0) return t; diff --git a/src/parse/check.c b/src/parse/check.c index 24519002..40506c40 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -152,7 +152,7 @@ ANN static inline m_bool ensure_check(const Env env, const Type t) { return envset_run(&es, t); } -ANN static inline m_bool ensure_traverse(const Env env, const Type t) { +ANN m_bool ensure_traverse(const Env env, const Type t) { struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)traverse_cdef, .scope=env->scope->depth, .flag=ae_flag_check }; return envset_run(&es, t);