Add missing data size check.

This commit is contained in:
Stephen Chung
2022-01-08 23:23:43 +08:00
parent f399e8a905
commit d1749131c5
2 changed files with 59 additions and 3 deletions

View File

@@ -141,6 +141,7 @@ impl Engine {
let args = &mut [lhs_ptr_inner, &mut new_val];
match self.call_native_fn(global, state, lib, op, hash, args, true, true, op_pos) {
Ok(_) => self.check_data_size(&mut args[0], root.1)?,
Err(err) if matches!(*err, ERR::ErrorFunctionNotFound(ref f, _) if f.starts_with(op)) =>
{
// Expand to `var = var op rhs`
@@ -153,7 +154,7 @@ impl Engine {
*args[0] = value.flatten();
}
err => return err.map(|_| ()),
Err(err) => return Err(err),
}
} else {
// Normal assignment