mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Scripting: prevent a code path to abort() in scripting
if scripting can't find an error handler it can call abort(). We don't ever want to do that in ArduPilot
This commit is contained in:
parent
4ad1231c8f
commit
f8097379cb
@ -128,7 +128,7 @@ l_noret luaD_throw (lua_State *L, int errcode) {
|
|||||||
lua_unlock(L);
|
lua_unlock(L);
|
||||||
g->panic(L); /* call panic function (last chance to jump out) */
|
g->panic(L); /* call panic function (last chance to jump out) */
|
||||||
}
|
}
|
||||||
abort();
|
lua_abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -956,4 +956,23 @@ int lua_range_finder_handle_script_msg(lua_State *L) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
lua wants to abort, and doesn't have access to a panic function
|
||||||
|
*/
|
||||||
|
void lua_abort()
|
||||||
|
{
|
||||||
|
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
|
||||||
|
#if AP_SIM_ENABLED
|
||||||
|
AP_HAL::panic("lua_abort called");
|
||||||
|
#else
|
||||||
|
if (!hal.util->get_soft_armed()) {
|
||||||
|
AP_HAL::panic("lua_abort called");
|
||||||
|
}
|
||||||
|
// abort while flying, all we can do is loop
|
||||||
|
while (true) {
|
||||||
|
hal.scheduler->delay(1000);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AP_SCRIPTING_ENABLED
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
@ -27,3 +27,5 @@
|
|||||||
#endif // REPL_OUT
|
#endif // REPL_OUT
|
||||||
|
|
||||||
int lua_get_current_ref();
|
int lua_get_current_ref();
|
||||||
|
void lua_abort(void) __attribute__((noreturn));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user