PATH_MAX is optional in POSIX, and it is not available on GNU/Hurd.
While it could be possible to not rely on PATH_MAX, for now provide a
fallback definition (which should be safe enough) to get quickjs built
on GNU/Hurd.
- use $(shell) make command to test if closefrom() is available
- use closefrom() if available in js_os_exec()
- limit the fallback loop to 1024 handles to avoid costly loop on linux alpine.
PR inspired by @nicolas-duteil-nova
* add `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` all accepting `JSValueConst`
* make `js_strict_eq` accept `JSValueConst`, remove uses of this function internally and replace them with
`js_strict_eq2` instead.
* Move fuzz target sources from the oss-fuzz repository here
* Add support to build libFuzzer targets
* Simplify the fuzz_eval and fuzz_compile targets
The use of JS_NewContext instead of JS_NewContextRaw spares to call
JS_AddIntrinsic<XYZ> functions from the fuzz target, since the public
JS_NewContext API does exactly the same.
* Simplify the fuzz_regexp target
fuzz_regexp doesn't need to be dependant on libquickjs since the
runtime and the context - that were provided by libquickjs - were
only created to call two simple functions implemented in libquickjs
which could be mimicked by the fuzzer.
The removal of runtime and context objects implicated further
simplifications, like the omission of their one-time creation.
Finally, writing the result of the regexp operations into a file
is also superfluous, since it's not used by anybody.
* Recreate and destroy JS runtime and context in fuzz_eval and fuzz_compile targets
Before this patch, the test executions were not independent,
since all the executed tests used the same JavaScript runtime and
context, causing irreproducible failure reports.
* Enable bignumber support in eval and compile targets
Big numbers are used by the input corpus, but the targets were not
able to interpret them since they were not compiled into them.
This change improved the inital coverage of the fuzz_eval target with
21% and the coverage of the fuzz_compile target with 25% when using
the official corpus.
* Ensure std and os modules are available in the fuzz_eval and fuzz_compile targets
* Add fuzzer dictionary with builtin and variable names. Furthermore, added a JS script that collects all the builtin
names from the executing engine.
* Move common fuzzer code into one place
* Enable to define the LIB_FUZZING_ENGINE variable to ease the oss-fuzz integration
* Add README to fuzzers
- detect and report invalid duplicate parameter names
- throw RangeError for too many function arguments
- throw RangeError for invalid string length
- prevent `-Wcast-function-type` warnings
- add `minimum_length` to enforce array length validation
- add `JS_NewDate()` API
- add `[Symbol.toStringTag]` property in the global object
- simplify `string_get_milliseconds`
- support more timezone abbrevs using `string_get_tzabbr` and array
This switches the exec test to `SIGTERM` rather than `SIGQUIT` since the
latter didn’t seem to work in QEMU, and the distinction doesn’t really
matter for this test.
This also makes the `isatty()` check smarter by checking whether `STDIN`
is, in fact, a terminal.
Added qemu-alpine targets i386, arm32v6, arm32v7, arm64v8, s390x
Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
- add `memcpy_no_ub` that accepts null pointers for 0 count
- prevent 0 length allocation in `js_worker_postMessage`
- use safer test for `int` value in `JS_NewFloat64`,
`JS_ToArrayLengthFree` and `js_typed_array_indexOf`
- accept many more alternative date/time formats
- add test cases in tests/test_builtin.js
- match month and timezone names case insensitively
- accept AM and PM markers
- recognize US timezone names
- skip parenthesized stuff
- fix almost all v8 test cases
- fix the conversions for integers and exact fractions
- approximate approach for other cases.
- bypass floating point conversions for JS_TAG_INT values
- avoid divisions for base 10 integer conversions
- ensure handler behavior does not depend on n argument
- load and save reference file in node.js
- add -s filename option to name the output reference file
- add targets in Makefile for tests and bencharks using node.js
- fix incorrect timings when not using high resolution timer
- use performance timer in node.js
- output performance factor instead of percentage
- use smaller threshold by default
- add benchmarks for:
date_parse(), prop_update(), prop_clone(), array_slice()
global_func_call(),
- rewrite Date.parse() with separate parsers
- return `NaN` for out of bounds field values as specified
- accept up to 9 decimals for millisecond fraction but truncate at 3
- accept many more alternative date/time formats
- add test cases in tests/test_builtin.js
- use `double` arithmetic where necessary to match the spec
- use `volatile` to ensure correct order of evaluation
and prevent FMA code generation
- reject some border cases.
- avoid undefined behavior in `double` -> `int64_t` conversions
- improved tests/test_builtin.js `assert` function to compare
values more reliably.
- added some tests in `test_date()`
- disable some of these tests on win32 and cygwin targets