fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

Prevent subsystem `fireWeapon` scripting function from triggering an assert

Open Kiloku opened this issue 3 years ago • 0 comments

It is possible for a script to call the fireWeapon subsystem function passing wnum as any integer. Down the line, wnum ends up passed to ai_turret::get_turret_weapon_wip, and could trigger either of those asserts:

Assert(weapon_num < MAX_SHIP_WEAPONS);
Assert(weapon_num >= 0);

This PR prevents that by giving an error and returning early.

Kiloku avatar Aug 14 '22 00:08 Kiloku