Commit graph

30 commits

Author SHA1 Message Date
Ben Noordhuis
0068db8a11 Avoid UB when checking if float fits in int32 2023-11-08 19:17:13 +01:00
Saúl Ibarra Corretgé
4f02ab8cfa
Fix use-after-free on error during module evaluation
E.g. if during evaluation of module A, we start loading module B and
an error occurs. This results in a call to js_free_modules() with
JS_FREE_MODULE_NOT_EVALUATED, and since module A isn't yet evaluated,
it gets freed prematurely.

To solve this we improve js_free_modules() to ensure `eval_mark` is not
set. Once js_evaluate_module() returns for module A, it will notice that
an exception occurred and call js_free_modules() with
JS_FREE_MODULE_NOT_EVALUATED. Since `eval_mark` has been cleared by then,
module A gets cleaned up as well.

Co-authored-by: Ole André Vadla Ravnås <oleavr@gmail.com>
2023-11-07 22:23:09 +01:00
Ben Noordhuis
a3a57febed
Implement Array.prototype.toReversed (#19) 2023-11-07 17:31:33 +01:00
Saúl Ibarra Corretgé
e2ae8746ca
Drop support for "use strip"
Ref: https://github.com/quickjs-ng/quickjs/issues/20
2023-11-07 00:29:11 +01:00
Saúl Ibarra Corretgé
1fb9a5010f
Drop support for "use math"
Ref: https://github.com/quickjs-ng/quickjs/issues/20
2023-11-06 23:07:31 +01:00
Ben Noordhuis
9b3b3084fa
Implement TypedArray.prototype.at (#18) 2023-11-06 00:05:44 +01:00
Ben Noordhuis
18eb603e0d
Implement Promise.withResolvers (#14) 2023-11-05 11:08:58 +01:00
Ben Noordhuis
99eb81e1a6
Implement Array.prototype.at (#13) 2023-11-05 11:08:46 +01:00
Ben Noordhuis
55018345ed
Implement String.prototype.at (#12) 2023-11-05 11:08:27 +01:00
Ben Noordhuis
e5bdada266 Remove unsafe sprintf() and strcat() calls
Prep work for enabling the sanitizers on macos CI since they are marked
as deprecated and cause the build to fail when -Werror is enabled.
2023-11-03 01:31:31 +01:00
Saúl Ibarra Corretgé
6d7fd42aae Add JS_GetUint8Array API
Shorthand for getting the underlying buffer of a Uint8Array.
2023-11-01 23:06:31 +01:00
Saúl Ibarra Corretgé
b11a10471d fixup! 2023-11-01 22:42:59 +01:00
Saúl Ibarra Corretgé
a9ac7a07ff Add top-level await support
Original author: zamfofex <zamfofex@twdb.moe>
2023-11-01 22:42:59 +01:00
Saúl Ibarra Corretgé
f51616eac8 Don't build with Atomics support by default
It's not currently implemented for Windows which makes the bytecode
generated by qjsc not portable.
2023-11-01 21:39:12 +01:00
Ben Noordhuis
d6fbd6b744 Fix UB signed integer overflow 2023-11-01 09:31:30 +01:00
Ben Noordhuis
4a8372a709 Fix UB left shift of negative number 2023-11-01 09:31:30 +01:00
Ben Noordhuis
a9957cdcee Fix UB nullptr passing to memcpy() 2023-11-01 09:31:30 +01:00
Ben Noordhuis
8217c69157 Fix UB shift into sign bit 2023-11-01 09:31:30 +01:00
Ben Noordhuis
f8b3a2e93c Fix sloppy mode arguments uninitialized value use
MemorySanitizer complained about uninitialized reads in
the indexed property code path in JS_GetPropertyValue()
with JS_CLASS_MAPPED_ARGUMENTS objects.
2023-11-01 05:20:14 +01:00
Ben Noordhuis
67585d0421 Fix -Wimplicit-const-int-float-conversion warnings
Compare against 0x1p63 instead of INT64_MAX. Converting INT64_MAX to
double rounds it up to INT64_MAX+1.

It made code like `if (d <= INT64_MAX) v = (int64_t)d;` behave subtly
wrong when `d >= 0x1p63` because then `v = (int64_t)d` wraps around to
a negative value.
2023-11-01 05:20:14 +01:00
bellard
446099aa9e added Object.hasOwn() 2022-03-06 18:54:27 +01:00
bellard
b9f58802dc fixed invalid Array.prototype.push/unshift optimization 2022-03-06 18:53:03 +01:00
bellard
b5e62895c6 2021-03-27 release 2021-03-27 11:17:31 +01:00
bellard
b1f67dfc1a 2020-11-08 release 2020-11-08 14:30:56 +01:00
bellard
7c312df422 2020-09-06 release 2020-09-06 19:10:15 +02:00
bellard
8900766099 2020-07-05 release 2020-09-06 19:07:30 +02:00
bellard
1722758717 2020-04-12 release 2020-09-06 19:04:20 +02:00
bellard
383e2b06c8 2020-03-16 release 2020-09-06 19:02:03 +02:00
bellard
0e8fffd4de 2020-01-19 release 2020-09-06 18:57:11 +02:00
bellard
91459fb672 2020-01-05 release 2020-09-06 18:53:08 +02:00