Otherwise it's too easy to tie up too many resources (cpu, memory) by
crafting inputs with a very large atom count (up to 4 billion.)
This may need some finetuning. If the limit proves too restrictive for
very large snapshots, we can make it relative to the size of the input.
Check inside the deserializer that const atoms are indeed const, don't
trust the input. The serializer only writes type 0 records for const
atoms but the byte stream may have been corrupted or manipulated.
Overlooked during review of c25aad7 ("Add ability to (de)serialize
symbols")
Found with libfuzzer and it found it _really_ fast. Great tool.
It's been super flaky due to GHA changes or the vmactions/netbsd-vm@v1
action it depends on, and I'm not invested enough to investigate.
If someone is motivated enough to fix it up, we can bring it back.
Fixes: https://github.com/quickjs-ng/quickjs/issues/600
Before this commit it segfaulted, now it throws a SyntaxError.
That's still not correct behavior but better than segfaulting.
To be continued.
Includes a small run-test262 fix to handle Windows line endings.
Refs: https://github.com/quickjs-ng/quickjs/issues/567
`JS_NewClassID(rt, &class_id)` where `class_id` is a global variable
is unsafe when called from multiple threads but that is exactly what
quickjs-libc.c did.
Add a new JS_AddRuntimeFinalizer function that lets quickjs-libc
store the class ids in JSRuntimeState and defer freeing the memory
until the runtime is destroyed. Necessary because object finalizers
such as js_std_file_finalizer need to know the class id and run after
js_std_free_handlers runs.
Fixes: https://github.com/quickjs-ng/quickjs/issues/577
This commit introduces a couple of changes in order to make run-test262
go brr and execute tests in parallel:
- Remove CONFIG_AGENT build option. The disabled version of the build
was already broken and no one noticed, Remove the define altogether.
- Remove the -C switch. Hard to support in multi-threaded mode.
I may bring it back some day because it _is_ useful.
- Remove the -r switch. Also hard to support and I never look at
test262_report.txt anyway so on the chopping block it goes.
- Judicious use of thread-local storage so I don't have to thread
through state everywhere and embiggen the diff even more.
This is what Real Programmers(TM) do: stay up coding way past midnight
just so the test suite finishes in one minute instead of four.
Fixes: https://github.com/quickjs-ng/quickjs/issues/547
It's currently printing them whenever a test takes one millisecond or
longer to complete.
Introduced in commit 7db24cc0da from earlier today, mea culpa.