Number of arguments are not checked when calling a function
jprendes opened this issue · comments
The following code prints garbage, while in my opinion it should error:
#include "quickjspp.hpp"
#include <cstdio>
int main()
{
qjs::Runtime runtime;
qjs::Context context(runtime);
context.global().add("f_with_3_args", [](int a, int b, int c) {
printf("%d %d %d\n", a, b, c);
});
context.eval("f_with_3_args(1);");
return 0;
}
The values from b and c are obtained from random areas of memory, potentially resulting in a segmentation fault.
Closed by #35