Add crashes and fixes found during fuzzy testing
* Let unhandled exceptions propogate to user * Report eval_error when break statement is not in loop * Fix handling of 0 length scripts closes #193 * Don't crash on arity mismatch - Specifically affects the case where no overloads exist for a given function * Fix error printing for `bind` calls * Handle unexpected continue statement * Check arity during bind * Don't allow arith conversion on variadic function * Correct `bind` parameter match count * Add in expected Boxed_Value exception cases * Check access to AST, don't allow `;` in func def * Don't attempt arithmetic unary & call * Don't crash on 0 param call to `bind` * Catch errors during member function dispatch * Properly handle type of const bool &
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "../chaiscript_defines.hpp"
|
||||
#include "../chaiscript_threading.hpp"
|
||||
#include "bad_boxed_cast.hpp"
|
||||
#include "boxed_cast.hpp"
|
||||
#include "boxed_cast_helper.hpp"
|
||||
#include "boxed_value.hpp"
|
||||
@@ -873,7 +874,14 @@ namespace chaiscript
|
||||
std::vector<Boxed_Value> remaining_params{l_params.begin() + l_num_params, l_params.end()};
|
||||
Boxed_Value bv = dispatch::dispatch(l_funs, attr_params, l_conversions);
|
||||
if (!remaining_params.empty() || bv.get_type_info().bare_equal(user_type<dispatch::Proxy_Function_Base>())) {
|
||||
return (*boxed_cast<const dispatch::Proxy_Function_Base *>(bv))(remaining_params, l_conversions);
|
||||
auto func = boxed_cast<std::shared_ptr<const dispatch::Proxy_Function_Base>>(bv);
|
||||
try {
|
||||
return (*func)(remaining_params, l_conversions);
|
||||
} catch (const chaiscript::exception::bad_boxed_cast &) {
|
||||
} catch (const chaiscript::exception::arity_error &) {
|
||||
} catch (const chaiscript::exception::guard_error &) {
|
||||
}
|
||||
throw chaiscript::exception::dispatch_error(remaining_params, std::vector<Const_Proxy_Function>{func});
|
||||
} else {
|
||||
return bv;
|
||||
}
|
||||
|
Reference in New Issue
Block a user