xNVSE / NVSE

New Vegas Script Extender (NVSE)
https://git.io/JfSAo
702 stars 55 forks source link

Functions can have junk extra args passed #171

Open Demorome opened 1 year ago

Demorome commented 1 year ago

Since this seems like a doozy to fix rn, I'm keeping this issue tracked for later.

Issue is: Inside vanilla (non-eval) if-checks, you can pass as many args as you want to a function and it'll compile in a messed up state, crashing the script. Probably a vanilla bug.

However, a probably separate instance of the same bug happens inside inline expressions, though when compiling it luckily ignore the extra args and behaves fine otherwise. Still, it should probably warn users they're passing too many args there.

ExpressionParser::ParseArgs probably mishandles it for inline expressions (?). Code's a bit dense and recursive though.

Here's a script file with all the test cases I've written, commented-out text won't compile. TestPassingExtraArgBug.txt