]>
git.kaiwu.me - njs.git/log
Dmitry Volyntsev [Wed, 13 Oct 2021 16:31:00 +0000 (16:31 +0000)]
SSL: fixed building with OpenSSL <= 1.0.1.
This closes #429 issue on Github.
Dmitry Volyntsev [Wed, 13 Oct 2021 15:29:50 +0000 (15:29 +0000)]
SSL: fixed typo introduced in
8e335c2ac447 .
Dmitry Volyntsev [Tue, 12 Oct 2021 17:24:31 +0000 (17:24 +0000)]
SSL: fixed compatibility with OpenSSL 3.0.
Dmitry Volyntsev [Mon, 11 Oct 2021 15:06:15 +0000 (15:06 +0000)]
Introduced WebCrypto API according to W3C spec.
The following methods were implemented:
crypto.getRandomValues()
crypto.subtle.importKey()
format: raw, pkcs8, spki
algorithm: AES-CBC, AES-CTR, AES-GCM,
ECDSA, HKDF, HMAC, PBKDF2,
RSASSA-PKCS1-v1_5, RSA-OAEP, RSA-PSS
crypto.subtle.decrypt()
crypto.subtle.encrypt()
algorithm: AES-CBC, AES-CTR, AES-GCM,
RSA-OAEP
crypto.subtle.deriveBits()
crypto.subtle.deriveKey()
algorithm: HKDF, PBKDF2
crypto.subtle.digest()
algorithm: SHA-1, SHA-256, SHA-384, SHA-512
crypto.subtle.sign()
crypto.subtle.verify()
algorithm: ECDSA, HMAC, RSASSA-PKCS1-v1_5, RSA-PSS
Alexander Borisov [Mon, 11 Oct 2021 14:46:24 +0000 (17:46 +0300)]
Fixed copying of closures for declared functions.
After
0a2a0b5a74f4 (0.6.0), the referencing of a closure value inside of
a nested function may result in heap-use-after-free. For this to happen
the closure value have to be referenced in a function invoked asynchronously.
For example if a closure value is referenced in r.subrequest() or setTimeout()
handler.
The problem was that closure values of nested function were assigned during
the function call and the memory shared between all the cloned VMs was used
to store temporary assignments until the moment the declared function was
referenced. When two VMs executed concurrently, the first VM might see
the changed made by the second VM if the first one was suspended.
The fix is to copy all declared functions at the time of the call.
This closes #421 issue on GitHub.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:50:50 +0000 (13:50 +0000)]
Tests: added async tests support.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:41:01 +0000 (13:41 +0000)]
Modules: introduced setReturnValue() method.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:41:00 +0000 (13:41 +0000)]
Modules: introduced common ngx_js_retval().
Dmitry Volyntsev [Fri, 8 Oct 2021 13:40:58 +0000 (13:40 +0000)]
Types: updated TS definitions.
Alexander Borisov [Fri, 8 Oct 2021 09:32:42 +0000 (12:32 +0300)]
Fixed unhandled promise rejection in handle events.
This closes #423 issue on GitHub.
Dmitry Volyntsev [Wed, 6 Oct 2021 13:16:09 +0000 (13:16 +0000)]
Style.
Sergey Kandaurov [Wed, 6 Oct 2021 12:57:14 +0000 (15:57 +0300)]
Fixed timeouts with Fetch, SSL and select.
Similar to the connection hang fixed in
058a67435e83 in nginx,
it is possible that an established connection is ready for reading
after the handshake. Further, events might be already disabled
in case of level-triggered event methods.
Fix is to post a read event if the c->read->ready flag is set.
Antoine Bonavita [Wed, 1 Sep 2021 18:43:56 +0000 (20:43 +0200)]
Added support for HTTPS URLs to the Fetch API.
The fetch API now accepts an extra parameters:
- verify: boolean (default true) to control server certificate
verification.
Verification process can be controlled with the following directives
from the http js and stream js modules:
- js_fetch_ciphers
- js_fetch_protocols
- js_fetch_verify_depth
- js_fetch_trusted_certificate
In collaboration with Dmitry Volyntsev.
Dmitry Volyntsev [Tue, 5 Oct 2021 13:01:11 +0000 (13:01 +0000)]
Modules: simplified reporting of failures in ngx.fetch() method.
Dmitry Volyntsev [Wed, 29 Sep 2021 16:13:36 +0000 (16:13 +0000)]
Tests: introducing repeat argument for unit tests.
Dmitry Volyntsev [Wed, 29 Sep 2021 13:45:26 +0000 (13:45 +0000)]
Fixed function constructor for cloned VMs.
Previously a shared "keywords_hash" and "values_hash" were used while
compiling functions in runtime. This led to populating a shared hash
with elements allocated in a cloned VM. Which resulted in
heap-use-after-free when next cloned VM accesses the shared hashes.
Dmitry Volyntsev [Fri, 17 Sep 2021 18:29:40 +0000 (18:29 +0000)]
Fixed njs_buffer_slot().
Previously, njs_buffer_slot() might return NULL value without setting
corresponding exception where user code expects it.
In addition the function is split into two functions. The internal one
does not set anything to vm->retval. This function has to be used by
property handlers, because they are expected not to modify vm->retval.
Dmitry Volyntsev [Fri, 17 Sep 2021 18:29:40 +0000 (18:29 +0000)]
Style.
Dmitry Volyntsev [Fri, 3 Sep 2021 14:57:50 +0000 (14:57 +0000)]
Fixed AsyncFunction prototype property "name".
According to the spec the AsyncFunction prototype does not
have own property "name".
Alexander Borisov [Thu, 2 Sep 2021 16:33:32 +0000 (19:33 +0300)]
Added async support for object initializer.
Alexander Borisov [Thu, 2 Sep 2021 16:33:03 +0000 (19:33 +0300)]
Parser: catching errors parsing in await expression.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:52 +0000 (19:32 +0300)]
Parser: removed dead store in await;
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:34 +0000 (19:32 +0300)]
Parser: fixed flag setting when parsing function arguments.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:27 +0000 (19:32 +0300)]
Fixed async ctx erasing when a function is called multiple times.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Wed, 1 Sep 2021 18:25:10 +0000 (21:25 +0300)]
Fixed order of code execution after await in try block.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Wed, 1 Sep 2021 13:31:08 +0000 (16:31 +0300)]
Introduced Async/Await implementation.
This closes #419 issue on GitHub.
Alexander Borisov [Wed, 1 Sep 2021 13:31:08 +0000 (16:31 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 31 Aug 2021 14:04:23 +0000 (14:04 +0000)]
Added tag 0.6.2 for changeset
dfba7f61745c
Dmitry Volyntsev [Tue, 31 Aug 2021 13:38:39 +0000 (13:38 +0000)]
Version 0.6.2.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:44 +0000 (13:16 +0000)]
Fixed %TypedArray%.prototype.join() with detached buffer.
The TypedArray buffer may be detached while evaluating custom
"separator" argument. The fix is to move the buffer check below this
point.
Found by Official ECMAScript Conformance Test Suite.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:43 +0000 (13:16 +0000)]
Memory: added cleanup handlers support.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:42 +0000 (13:16 +0000)]
Allowing to pass arbitrary pointer to object iterator handler.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:42 +0000 (13:16 +0000)]
Shell: fixed memory leak in script options.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:32 +0000 (13:16 +0000)]
Fixed backtrace output for arrays broken in
b0177571ce1d .
After the previous commit the array prototype methods were not found
during njs_object_traverse() invocation. As the result the exceptions in
Array.prototype methods were reported with a backtrace containing "native
(native)" instead of a proper function name.
Dmitry Volyntsev [Thu, 19 Aug 2021 16:17:19 +0000 (16:17 +0000)]
Refactored njs_object_traverse().
The previous approach was inconsistent in treating shared properties
with other places (JSON.stringify()) where object is iterated.
Dmitry Volyntsev [Fri, 13 Aug 2021 12:20:46 +0000 (12:20 +0000)]
Allowing to create external objects with NULL external pointer.
Miao Wang [Wed, 11 Aug 2021 03:44:12 +0000 (11:44 +0800)]
Stream: fixed CPU hog when js_filter is registered in both directions.
Previously, a single busy chain was used to track filtered data in both
directions. This might lead to a situation when busy chunks are not
freed properly and pile up.
The fix is to separate busy chain for upstream and downstream directions.
This closes #413 issue on Github.
Alexander Borisov [Wed, 11 Aug 2021 18:48:52 +0000 (21:48 +0300)]
Added remaining Promise constructor methods.
The following methods were added: Promise.all(), Promise.allSettled(),
Promise.any(), Promise.race().
Alexander Borisov [Wed, 11 Aug 2021 18:48:51 +0000 (21:48 +0300)]
Fixed resolve/reject callback for Promise.prototype.finally().
Alexander Borisov [Wed, 11 Aug 2021 18:48:51 +0000 (21:48 +0300)]
Introduced AggregateError implementation.
Alexander Borisov [Wed, 11 Aug 2021 18:48:50 +0000 (21:48 +0300)]
Moving generic iterator code to a proper location.
Alexander Borisov [Thu, 15 Jul 2021 17:32:44 +0000 (20:32 +0300)]
The maximum depth of nested functions is set to 128.
Alexander Borisov [Thu, 15 Jul 2021 17:32:43 +0000 (20:32 +0300)]
Removed recursion from finding let closures.
Alexander Borisov [Thu, 15 Jul 2021 17:32:40 +0000 (20:32 +0300)]
Removed recursion from code generator.
Dmitry Volyntsev [Thu, 15 Jul 2021 14:51:57 +0000 (14:51 +0000)]
Added generic AST traverser.
Dmitry Volyntsev [Wed, 14 Jul 2021 13:18:56 +0000 (13:18 +0000)]
File flags table cleanup.
Dmitry Volyntsev [Tue, 13 Jul 2021 15:22:24 +0000 (15:22 +0000)]
Added support for ArrayBuffer in njs_vm_value_to_bytes().
hyeonisism [Tue, 13 Jul 2021 01:23:23 +0000 (10:23 +0900)]
Added fs flags missed in
5c6aa60224cb (0.1.15).
This closes #405 issue on Github.
Dmitry Volyntsev [Fri, 9 Jul 2021 19:14:23 +0000 (19:14 +0000)]
Marking different external pointer with unique tag.
An external value has an arbitrary raw pointer associated with it.
External values with different prototypes have different C-level
structures. To ensure that only appropriate structures are fetched
by njs_vm_external() the unique tag has to be provided during
creation of external values.
Dmitry Volyntsev [Fri, 9 Jul 2021 14:01:26 +0000 (14:01 +0000)]
Modules: improved working with external prototypes.
This patch avoids relying on the order in which external prototypes are
registered. Instead, the returned proto_id is expected to be stored
somewhere.
Valentin Bartenev [Fri, 9 Jul 2021 09:03:11 +0000 (12:03 +0300)]
Unicode case tables updated to version 14.0.0 (May 2021).
Alexander Borisov [Tue, 29 Jun 2021 14:08:23 +0000 (17:08 +0300)]
Fixed rest parameter parsing without binding identifier.
This closes #400 issue on GitHub.
Alexander Borisov [Tue, 29 Jun 2021 14:08:21 +0000 (17:08 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 29 Jun 2021 12:12:57 +0000 (12:12 +0000)]
Added tag 0.6.1 for changeset
4adbe67b292a
Dmitry Volyntsev [Tue, 29 Jun 2021 11:47:04 +0000 (11:47 +0000)]
Version 0.6.1.
Artem S. Povalyukhin [Thu, 24 Jun 2021 05:53:12 +0000 (08:53 +0300)]
Fixed parsing of export default declarations.
With non-assignment expression.
Dmitry Volyntsev [Fri, 25 Jun 2021 17:00:12 +0000 (17:00 +0000)]
Fixed RegExpBuiltinExec() with UTF-8 only regexps.
The original issue was introduced in
f9082cd59ba6 (0.4.2) while adding
RegExpBuiltinExec(), but after
de64420d0f2b (0.6.0) it started to affect
RegExp.prototype.test() as it was rewritten according to spec.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:48 +0000 (15:01 +0000)]
Introduced "debugger" token support.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:13 +0000 (15:01 +0000)]
Fixed printing AST with recently added tokens.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:12 +0000 (15:01 +0000)]
Printing AST before trying to generate code.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:00:32 +0000 (15:00 +0000)]
Version bump.
Dmitry Volyntsev [Tue, 15 Jun 2021 12:53:09 +0000 (12:53 +0000)]
Added tag 0.6.0 for changeset
742ebceef2b5
Dmitry Volyntsev [Tue, 15 Jun 2021 12:05:34 +0000 (12:05 +0000)]
Version 0.6.0.
Dmitry Volyntsev [Tue, 15 Jun 2021 11:54:03 +0000 (11:54 +0000)]
Added forgotten paragraph section for 0.5.2.
Dmitry Volyntsev [Fri, 11 Jun 2021 18:28:21 +0000 (18:28 +0000)]
Fixed use-of-uninitialized-value in njs_string_index().
Found by MemorySanitizer.
Dmitry Volyntsev [Fri, 11 Jun 2021 15:47:37 +0000 (15:47 +0000)]
Fixed RegExp.prototype.[@@split]() with UTF8 strings.
Found by OSS-Fuzz.
Dmitry Volyntsev [Fri, 11 Jun 2021 15:15:48 +0000 (15:15 +0000)]
Fixed dumping of objects with circular references.
This closes #395 issue on Github.
Dmitry Volyntsev [Wed, 9 Jun 2021 17:14:10 +0000 (17:14 +0000)]
Fixed String.prototype.split() according to the specification.
This closes #359 issue on GitHub.
Dmitry Volyntsev [Tue, 8 Jun 2021 18:01:25 +0000 (18:01 +0000)]
Added benchmarks for String.prototype.split().
Dmitry Volyntsev [Sat, 5 Jun 2021 11:55:08 +0000 (11:55 +0000)]
Introduced RegExp.prototype.sticky support.
Dmitry Volyntsev [Tue, 8 Jun 2021 12:43:13 +0000 (12:43 +0000)]
Fixed use-of-uninitialized-value while tracking rejected promises.
Found by Found by MemorySanitizer.
Dmitry Volyntsev [Sat, 5 Jun 2021 11:55:08 +0000 (11:55 +0000)]
Accessing "lastIndex" property according to the spec.
Dmitry Volyntsev [Sat, 5 Jun 2021 11:55:08 +0000 (11:55 +0000)]
Fixed RegExp.prototype.test() according to the specification.
Dmitry Volyntsev [Sat, 5 Jun 2021 11:58:00 +0000 (11:58 +0000)]
Implemented RegExp getters according to the specification.
Dmitry Volyntsev [Wed, 2 Jun 2021 14:10:03 +0000 (14:10 +0000)]
Improved arguments parsing in Date constructor.
Dmitry Volyntsev [Wed, 2 Jun 2021 13:25:32 +0000 (13:25 +0000)]
Fixed integer-overflow in MakeDay().
Found by OSS-Fuzz.
Dmitry Volyntsev [Mon, 31 May 2021 06:55:34 +0000 (06:55 +0000)]
Fixed misaligned reading and writing.
error: load of misaligned address 0x62500de0ab11 for type 'uint16_t',
which requires 2 byte alignment.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Mon, 31 May 2021 06:55:32 +0000 (06:55 +0000)]
Removing the requirement of "aligned" attribute support.
Before
0a2a0b5a74f4 , the address of values used in runtime had to be the
multiple of 16, because the address of a variable was used as its VM
index. The first 4 bits of an index signified the scope of a varible.
This is no longer the case, after
0a2a0b5a74f4 the address of a variable
is never used as its VM index.
Dmitry Volyntsev [Fri, 28 May 2021 15:23:03 +0000 (15:23 +0000)]
Style.
Dmitry Volyntsev [Fri, 28 May 2021 14:00:04 +0000 (14:00 +0000)]
Fixed heap-buffer-overflow in String.prototype.lastIndexOf().
Previously, the issue occurred when the searchValue is shorter
in character length than "this" string, but longer in byte length.
Dmitry Volyntsev [Mon, 24 May 2021 14:18:15 +0000 (14:18 +0000)]
Fixed ToInt32() with values >= 2**(53+30).
Dmitry Volyntsev [Mon, 24 May 2021 14:17:59 +0000 (14:17 +0000)]
Fixed integer-overflow in ToInt32().
error: negation of -
2147483648 cannot be represented in type 'int32_t'.
Found by OSS-Fuzz.
Dmitry Volyntsev [Mon, 24 May 2021 12:33:43 +0000 (12:33 +0000)]
Fixed implicit long to double conversion warning.
error: implicit conversion from 'long' to 'double' changes value from
9223372036854775807 to
9223372036854775808 .
Dmitry Volyntsev [Mon, 24 May 2021 12:33:36 +0000 (12:33 +0000)]
Suppressed spurious compilation warning with gcc-7 and older.
src/njs_regexp.c:1335:19: error: ‘pos’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
pos = njs_string_offset(s.start, s.start + s.size, pos) - s.start;
Dmitry Volyntsev [Mon, 24 May 2021 10:51:48 +0000 (10:51 +0000)]
Simplified String.prototype.repeat() to match the spec.
Dmitry Volyntsev [Mon, 24 May 2021 10:51:47 +0000 (10:51 +0000)]
Fixed undefined behaviour in njs_number_to_integer().
C11: 6.3.1.4
... If the value of the integral part cannot be represented by the
integer type, the behavior is undefined.
Found by OSS-Fuzz.
Alexander Borisov [Mon, 17 May 2021 17:35:35 +0000 (20:35 +0300)]
Fixed parsing case/default in an unclosed function block in switch.
Alexander Borisov [Thu, 6 May 2021 13:07:09 +0000 (16:07 +0300)]
Removed check variable type for CLI completions.
Found by Coverity (CID
1478003 ).
Alexander Borisov [Thu, 6 May 2021 13:07:08 +0000 (16:07 +0300)]
Removed unnecessary NULL checks introduced in
0a2a0b5a74f4 .
Found by Coverity (CID
1478004 ).
Alexander Borisov [Thu, 6 May 2021 13:07:06 +0000 (16:07 +0300)]
Removed unnecessary NULL checks introduced in
0a2a0b5a74f4 .
Found by Coverity (CID
1478008 ).
Alexander Borisov [Thu, 6 May 2021 13:07:05 +0000 (16:07 +0300)]
Fixed typo introduced in
27a4a52621d5 and
f58a06be33dc .
Alexander Borisov [Fri, 30 Apr 2021 13:02:34 +0000 (16:02 +0300)]
Introduced const implementation.
Alexander Borisov [Fri, 30 Apr 2021 13:02:28 +0000 (16:02 +0300)]
Introduced let implementation.
This closes #105 issue on GitHub.
Alexander Borisov [Fri, 30 Apr 2021 13:02:20 +0000 (16:02 +0300)]
Introduced reserved words in strict mode.
Alexander Borisov [Fri, 30 Apr 2021 13:02:08 +0000 (16:02 +0300)]
Scopes refactoring.
Dmitry Volyntsev [Fri, 16 Apr 2021 15:25:22 +0000 (15:25 +0000)]
Introduced "undefined" as a token in lexer.
Dmitry Volyntsev [Fri, 30 Apr 2021 10:10:57 +0000 (10:10 +0000)]
Added function micro benchmarks.
Dmitry Volyntsev [Fri, 16 Apr 2021 13:46:46 +0000 (13:46 +0000)]
Fixed expect tests.
Dmitry Volyntsev [Fri, 16 Apr 2021 13:35:20 +0000 (13:35 +0000)]
Version bump.
Dmitry Volyntsev [Tue, 30 Mar 2021 13:58:27 +0000 (13:58 +0000)]
Added tag 0.5.3 for changeset
282b9412976c