]> git.kaiwu.me - njs.git/log
njs.git
22 months ago Modules: removed extra copying in shared dictionary.
Dmitry Volyntsev [Tue, 11 Jun 2024 06:06:26 +0000 (23:06 -0700)]
 Modules: removed extra copying in shared dictionary.

 After 5730d5f pool copy is not needed because
 njs_vm_value_string_create() always create a copy.

23 months agoModules: shared dictionary add, set, incr methods timeout argument.
jo-carter [Sun, 2 Jun 2024 08:11:13 +0000 (09:11 +0100)]
Modules: shared dictionary add, set, incr methods timeout argument.

The optional timeout argument overrides the timeout specified with
the shared_dict_zone directive for the effected key and operation
only. The timeout is specified in milliseconds.

This is useful when the majority of keys are expected to require
unique timeouts.

23 months agoFixed integer overflow in Date.parse().
Dmitry Volyntsev [Sat, 8 Jun 2024 05:58:53 +0000 (22:58 -0700)]
Fixed integer overflow in Date.parse().

Found by OSS-Fuzz and UndefinedSanitizer.

23 months agoFixed tracking of argument scope.
Dmitry Volyntsev [Sat, 8 Jun 2024 04:46:30 +0000 (21:46 -0700)]
Fixed tracking of argument scope.

This properly catches unsupported "await" in arguments.

This fixes #730 issue on Github.

23 months agoTests: compatibility with "openssl" app from OpenSSL 3.2.0.
Dmitry Volyntsev [Thu, 6 Jun 2024 21:54:45 +0000 (14:54 -0700)]
Tests: compatibility with "openssl" app from OpenSSL 3.2.0.

23 months agoFixed open byte overread in decodeURI() and decodeURIComponent().
Dmitry Volyntsev [Fri, 7 Jun 2024 06:10:12 +0000 (23:10 -0700)]
Fixed open byte overread in decodeURI() and decodeURIComponent().

Found by OSS-Fuzz and MemorySanitizer.

23 months agoAdded reference to nginx community page at SUPPORT.md.
Dmitry Volyntsev [Thu, 6 Jun 2024 01:23:18 +0000 (18:23 -0700)]
Added reference to nginx community page at SUPPORT.md.

23 months agoUpdated README
Michael Vernik [Fri, 31 May 2024 06:24:30 +0000 (23:24 -0700)]
Updated README
New Readme content and added .md extension

23 months agoAdded contributing guide.
Dmitry Volyntsev [Wed, 29 May 2024 01:34:22 +0000 (18:34 -0700)]
Added contributing guide.

23 months agoTest262: fixed unstable fs test.
Dmitry Volyntsev [Thu, 30 May 2024 05:26:09 +0000 (22:26 -0700)]
Test262: fixed unstable fs test.

Ensuring that symlink file is removed even if regular file does not
exist.

23 months agoTest262: fixed flaky fs tests.
Dmitry Volyntsev [Thu, 30 May 2024 05:23:55 +0000 (22:23 -0700)]
Test262: fixed flaky fs tests.

Previously, two tests running in parallel could occasionally generate
identical file names because Math.random() was used for part of the file
name, leading to one of the tests failing.

The fix is to use a single global counter to generate file names,
ensuring deterministic and unique file names for each test.

23 months agoAdded issue templates.
Dmitry Volyntsev [Thu, 30 May 2024 00:04:27 +0000 (17:04 -0700)]
Added issue templates.

23 months agoAdded support guide.
Dmitry Volyntsev [Wed, 29 May 2024 23:29:47 +0000 (16:29 -0700)]
Added support guide.

23 months agoAdded security policy.
Dmitry Volyntsev [Wed, 29 May 2024 01:41:49 +0000 (18:41 -0700)]
Added security policy.

23 months agoAdded code of conduct.
Dmitry Volyntsev [Wed, 29 May 2024 01:00:10 +0000 (18:00 -0700)]
Added code of conduct.

23 months agoFixed RegExp.prototype[@@replace]().
Dmitry Volyntsev [Tue, 28 May 2024 22:49:39 +0000 (15:49 -0700)]
Fixed RegExp.prototype[@@replace]().

With replacement containing "$'", "$\`" and Unicode characters.

The similar issue was fixed for String.prototype.replace() in
10127d70e941 (0.7.11).

Found by OSS-Fuzz.

23 months agoAdded CI based on GitHub Actions.
Konstantin Pavlov [Fri, 5 Apr 2024 20:27:37 +0000 (13:27 -0700)]
Added CI based on GitHub Actions.

23 months agoTest262: improved skipping of tests.
Dmitry Volyntsev [Tue, 28 May 2024 21:16:14 +0000 (14:16 -0700)]
Test262: improved skipping of tests.

The skipped tests (which are expected to fail) are not executed in order
to make output clearer.

23 months agoFetch: fixed heap-buffer-overflow in Headers.get(). branches/default
Dmitry Volyntsev [Fri, 24 May 2024 05:50:34 +0000 (22:50 -0700)]
Fetch: fixed heap-buffer-overflow in Headers.get().

Previously, when more than one header with the same name added to a
Headers object and Headers.get() was used to get the the duplicate
header heap-buffer-overflow occured. The overflow occurred due to an
incorrect calculation of the combined header value's length.

The issue was introduced in c43261bad627 (0.7.10).

23 months agoAdded fast path in njs_chb_utf8_length() for ASCII input.
Dmitry Volyntsev [Fri, 24 May 2024 05:50:19 +0000 (22:50 -0700)]
Added fast path in njs_chb_utf8_length() for ASCII input.

23 months agoFixed retval handling after an exception.
Dmitry Volyntsev [Thu, 23 May 2024 06:08:15 +0000 (23:08 -0700)]
Fixed retval handling after an exception.

Previously, some functions set a retval too early.  If this happened
before an exception a partially created object in inconsistent state
may be visible outside the affected functions.

The following functions were fixed:
Object.prototype.valueOf()
Array.prototype.toSpliced()
Array.prototype.toReversed()
Array.prototype.toSorted()

This fixes #713 issue on Github.

23 months agoImproved String.prototype.replaceAll() for readability.
Dmitry Volyntsev [Thu, 23 May 2024 00:26:16 +0000 (17:26 -0700)]
Improved String.prototype.replaceAll() for readability.

23 months agoFixed String.prototype.replaceAll() with zero length argument.
Dmitry Volyntsev [Thu, 23 May 2024 00:26:08 +0000 (17:26 -0700)]
Fixed String.prototype.replaceAll() with zero length argument.

This fixes #712 issue on Github.

23 months agoAligned StringIndexOf() implementation with the spec.
Dmitry Volyntsev [Wed, 22 May 2024 06:41:10 +0000 (23:41 -0700)]
Aligned StringIndexOf() implementation with the spec.

When searchValue is empty the function should return early
when fromIndex <= len is also true.

23 months agoRemoved code for byte strings in built-in functions.
Dmitry Volyntsev [Wed, 22 May 2024 06:41:10 +0000 (23:41 -0700)]
Removed code for byte strings in built-in functions.

23 months agoAvoid creating byte strings explicitly.
Dmitry Volyntsev [Wed, 22 May 2024 06:38:19 +0000 (23:38 -0700)]
Avoid creating byte strings explicitly.

Previously, calls like njs_string_new(,,,0) produced byte strings by
explicitly providing zero length argument.

23 months agoHTTP: fixed handling of 0 length request body.
Dmitry Volyntsev [Mon, 20 May 2024 23:44:10 +0000 (16:44 -0700)]
HTTP: fixed handling of 0 length request body.

Previously, when r.requestBuffer was passed as a body argument to
ngx.fetch() or r.subrequest() then exception was thrown "Error: invalid
Request body" when the request body had 0 length.

23 months agoRemoving njs_string_set() from builtin functions.
Dmitry Volyntsev [Sat, 18 May 2024 04:54:50 +0000 (21:54 -0700)]
Removing njs_string_set() from builtin functions.

This is the last function that produced byte strings.

23 months agoChange: removed byte strings API.
Dmitry Volyntsev [Sat, 18 May 2024 04:54:50 +0000 (21:54 -0700)]
Change: removed byte strings API.

These functions are unsafe because they produce byte strings.
Byte strings may not work as expected with the existing JS methods.

The following functions were removed:
    - njs_vm_value_string_set() use njs_vm_value_string_create() as a
    drop-in replacement.
    - njs_vm_value_string_alloc() use njs_chb_t and
    njs_vm_value_string_create_chb() instead.

This fixes #710 on Github.

23 months agoOptimized string creation with ASCII input.
Dmitry Volyntsev [Sat, 18 May 2024 04:54:49 +0000 (21:54 -0700)]
Optimized string creation with ASCII input.

23 months agoAdded string creation benchmark.
Dmitry Volyntsev [Sat, 18 May 2024 01:36:12 +0000 (18:36 -0700)]
Added string creation benchmark.

2 years agoConfigure: fixed QuickJS detection with --with-quickjs flag.
Dmitry Volyntsev [Thu, 9 May 2024 19:58:57 +0000 (12:58 -0700)]
Configure: fixed QuickJS detection with --with-quickjs flag.

2 years agoQuickJS: added zlib module.
Dmitry Volyntsev [Thu, 2 May 2024 00:31:01 +0000 (17:31 -0700)]
QuickJS: added zlib module.

2 years agoTests: fixed typo in stream_js_dup_set.t introduced in be271e8d0b3b.
Dmitry Volyntsev [Fri, 26 Apr 2024 23:48:19 +0000 (16:48 -0700)]
Tests: fixed typo in stream_js_dup_set.t introduced in be271e8d0b3b.

Previously, with typo the test was always skipped.

2 years agoFetch: fixed request Host header when the port is non-standard.
Dmitry Volyntsev [Fri, 26 Apr 2024 23:48:17 +0000 (16:48 -0700)]
Fetch: fixed request Host header when the port is non-standard.

This fixes #707 issue on Github.

2 years agoAllowing to use custom allocator in njs_chb_t.
Dmitry Volyntsev [Fri, 26 Apr 2024 23:27:52 +0000 (16:27 -0700)]
Allowing to use custom allocator in njs_chb_t.

2 years agoConfigure: fixed default path QuickJS discovery typo.
Dmitry Volyntsev [Tue, 23 Apr 2024 01:59:03 +0000 (18:59 -0700)]
Configure: fixed default path QuickJS discovery typo.

The issue was introduced in 1c8b6b9bc06c (0.8.4).

This closes #706 issue on Github.

2 years agoZlib: improved tests with zlib-ng.
Dmitry Volyntsev [Tue, 23 Apr 2024 00:52:14 +0000 (17:52 -0700)]
Zlib: improved tests with zlib-ng.

This fixes #704 issue on Github.

2 years agoZlib: fixed inflate().
Dmitry Volyntsev [Tue, 23 Apr 2024 00:52:06 +0000 (17:52 -0700)]
Zlib: fixed inflate().

Previously, the function might fail to return the last part of the
compressed content. This problem is more visible when output size > 1024
or when chunkSize < the content size.

2 years agoModules: improved checking for duplicate js_set variables.
Dmitry Volyntsev [Tue, 23 Apr 2024 00:51:45 +0000 (17:51 -0700)]
Modules: improved checking for duplicate js_set variables.

Since 6fb1aca4eeaf (0.8.4) the identical js_set variables introduced as
a part of an include file that is shared amongst multiple vhosts are
rejected during configuration parsing.

The patch ignores duplicate js_set variables when they refer to the same
JS function.

This fixes #705 issue on Github.

2 years agoVersion bump.
Dmitry Volyntsev [Tue, 23 Apr 2024 00:51:24 +0000 (17:51 -0700)]
Version bump.

2 years agoAdded tag 0.8.4 for changeset 11d956c1577c
Dmitry Volyntsev [Mon, 15 Apr 2024 23:44:33 +0000 (16:44 -0700)]
Added tag 0.8.4 for changeset 11d956c1577c

2 years agoVersion 0.8.4. 0.8.4
Dmitry Volyntsev [Mon, 15 Apr 2024 23:40:21 +0000 (16:40 -0700)]
Version 0.8.4.

2 years agoHTTP: fixed r.send() with Buffer argument.
Dmitry Volyntsev [Tue, 9 Apr 2024 05:47:28 +0000 (22:47 -0700)]
HTTP: fixed r.send() with Buffer argument.

Previously, only string value type was accepted.

This closes #701 issue on Github.

2 years agoModules: checking for duplicate js_set variables.
Dmitry Volyntsev [Tue, 9 Apr 2024 05:47:24 +0000 (22:47 -0700)]
Modules: checking for duplicate js_set variables.

This closes #700 issue on Github.

2 years agoConfigure: added --with-quickjs option.
Dmitry Volyntsev [Thu, 4 Apr 2024 23:07:53 +0000 (16:07 -0700)]
Configure: added --with-quickjs option.

2 years agoConfigure: improved QuickJS discovery.
Dmitry Volyntsev [Thu, 4 Apr 2024 23:07:46 +0000 (16:07 -0700)]
Configure: improved QuickJS discovery.

At the first try do not assume the exact library and includes location.

2 years agoConfigure: added --no-quickjs description in configure --help.
Dmitry Volyntsev [Thu, 4 Apr 2024 23:07:39 +0000 (16:07 -0700)]
Configure: added --no-quickjs description in configure --help.

Forgotten in cb3e068a511c.

2 years agoConfigure: sorted options alphabetically in configure --help.
Dmitry Volyntsev [Thu, 4 Apr 2024 23:07:37 +0000 (16:07 -0700)]
Configure: sorted options alphabetically in configure --help.

2 years agoHTTP: validating URI and args arguments in r.subrequest().
Dmitry Volyntsev [Tue, 2 Apr 2024 15:52:56 +0000 (08:52 -0700)]
HTTP: validating URI and args arguments in r.subrequest().

2 years agoTests: adapt stream_js.t to nginx changes.
Dmitry Volyntsev [Tue, 2 Apr 2024 06:13:25 +0000 (23:13 -0700)]
Tests: adapt stream_js.t to nginx changes.

Make the test more robust against changes in nginx, specifically
cf890df37bb6 (Stream: socket peek in preread phase).

The filter callbacks may be called multiple times by nginx and the exact
number is not specified. The new test avoids relying on the exact number
of calls from nginx.

2 years agoTests: adapt stream_js_preload_object.t to nginx changes.
Dmitry Volyntsev [Tue, 2 Apr 2024 06:13:24 +0000 (23:13 -0700)]
Tests: adapt stream_js_preload_object.t to nginx changes.

Make the test more robust against changes in nginx, specifically
cf890df37bb6 (Stream: socket peek in preread phase).

The filter callbacks may be called multiple times by nginx and the exact
number is not specified. The new test avoids relying on the exact number
of calls from nginx.

2 years agoTests: simplified stream_js_import2.t.
Dmitry Volyntsev [Tue, 2 Apr 2024 06:13:23 +0000 (23:13 -0700)]
Tests: simplified stream_js_import2.t.

The test should only verify js_import directive in server context
according to its description.

2 years agoTests: removed stream_js_import.t.
Dmitry Volyntsev [Tue, 2 Apr 2024 06:13:21 +0000 (23:13 -0700)]
Tests: removed stream_js_import.t.

js_import is the only directive to load JS code since 0.7.1, so the test is
redundant.

2 years agoModules: fixed clear() method of a shared dictionary without timeout.
Dmitry Volyntsev [Wed, 20 Mar 2024 04:05:51 +0000 (21:05 -0700)]
Modules: fixed clear() method of a shared dictionary without timeout.

Previously, the code did not unlock the rwlock when a dict was empty.

The issue was introduced in 4a15613f4e8b (0.8.3).

This closes issue #699 on Github.

2 years agoShell: added completions for QuickJS engine.
Dmitry Volyntsev [Tue, 19 Mar 2024 05:24:57 +0000 (22:24 -0700)]
Shell: added completions for QuickJS engine.

2 years agoShell: completions are refactored and moved out of the core.
Dmitry Volyntsev [Tue, 19 Mar 2024 05:15:48 +0000 (22:15 -0700)]
Shell: completions are refactored and moved out of the core.

2 years agoIntroduced njs_vm_value_enumerate() and njs_vm_value_own_enumerate().
Dmitry Volyntsev [Sat, 16 Mar 2024 06:14:39 +0000 (23:14 -0700)]
Introduced njs_vm_value_enumerate() and njs_vm_value_own_enumerate().

2 years agoRefactoring njs_value_own_enumerate() and friends.
Dmitry Volyntsev [Sat, 16 Mar 2024 05:47:50 +0000 (22:47 -0700)]
Refactoring njs_value_own_enumerate() and friends.

All three flag-like arguments are merged into a single flag argument.

2 years agoIntroduced njs_vm_prototype() to get a value's prototype.
Dmitry Volyntsev [Fri, 15 Mar 2024 06:28:03 +0000 (23:28 -0700)]
Introduced njs_vm_prototype() to get a value's prototype.

2 years agoIntroduced njs_vm_global() to get global object.
Dmitry Volyntsev [Fri, 15 Mar 2024 06:28:03 +0000 (23:28 -0700)]
Introduced njs_vm_global() to get global object.

2 years agoFixed typo introduced in eb01434865d7.
Dmitry Volyntsev [Tue, 5 Mar 2024 19:43:49 +0000 (11:43 -0800)]
Fixed typo introduced in eb01434865d7.

2 years agoHTTP: allowing to set Server header.
Dmitry Volyntsev [Fri, 1 Mar 2024 04:56:56 +0000 (20:56 -0800)]
HTTP: allowing to set Server header.

2 years agoShell: revert -t option back to preserve backward compatibility.
Dmitry Volyntsev [Fri, 1 Mar 2024 02:56:13 +0000 (18:56 -0800)]
Shell: revert -t option back to preserve backward compatibility.

The issue was introduced in cb3e068a511c.

2 years agoRemoved duplicate expect tests introduced in cb3e068a511c.
Dmitry Volyntsev [Wed, 28 Feb 2024 07:25:11 +0000 (23:25 -0800)]
Removed duplicate expect tests introduced in cb3e068a511c.

2 years agoShell: fixed memory pool issues introduced in cb3e068a511c.
Dmitry Volyntsev [Wed, 28 Feb 2024 07:25:05 +0000 (23:25 -0800)]
Shell: fixed memory pool issues introduced in cb3e068a511c.

2 years agoSimplified working with global value.
Dmitry Volyntsev [Wed, 28 Feb 2024 07:24:55 +0000 (23:24 -0800)]
Simplified working with global value.

2 years agoShell: added QuickJS engine support.
Dmitry Volyntsev [Fri, 23 Feb 2024 04:25:43 +0000 (20:25 -0800)]
Shell: added QuickJS engine support.

2 years agoFixed atob() with non-padded base64 strings.
Dmitry Volyntsev [Fri, 23 Feb 2024 01:38:58 +0000 (17:38 -0800)]
Fixed atob() with non-padded base64 strings.

This fixes #695 issue on Github.

2 years agoMoving hash code out of the njs core.
Dmitry Volyntsev [Thu, 15 Feb 2024 05:34:02 +0000 (21:34 -0800)]
Moving hash code out of the njs core.

2 years agoMoved njs_time() out of the core as it is not a part of the spec.
Dmitry Volyntsev [Thu, 15 Feb 2024 05:33:56 +0000 (21:33 -0800)]
Moved njs_time() out of the core as it is not a part of the spec.

2 years agoTest262: fix import_global_ref_var.t.js.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:02 +0000 (17:57 -0800)]
Test262: fix import_global_ref_var.t.js.

2 years agoTest262: simplified import_chain.t.js.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:01 +0000 (17:57 -0800)]
Test262: simplified import_chain.t.js.

Avoid using "crypto" module, which unnessesary complicates the test.

2 years agoRemoved njs_file.c not needed after 8aad26845b18 (0.8.3).
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:01 +0000 (17:57 -0800)]
Removed njs_file.c not needed after 8aad26845b18 (0.8.3).

2 years agoVersion bump.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:56:59 +0000 (17:56 -0800)]
Version bump.

2 years agoAdded tag 0.8.3 for changeset 3aba7ee62080
Dmitry Volyntsev [Wed, 7 Feb 2024 16:34:17 +0000 (08:34 -0800)]
Added tag 0.8.3 for changeset 3aba7ee62080

2 years agoVersion 0.8.3. 0.8.3
Dmitry Volyntsev [Wed, 7 Feb 2024 16:34:00 +0000 (08:34 -0800)]
Version 0.8.3.

2 years agoReverted changes introduced in 7eaaa7d57636 (not released) back.
Dmitry Volyntsev [Wed, 7 Feb 2024 03:32:08 +0000 (19:32 -0800)]
Reverted changes introduced in 7eaaa7d57636 (not released) back.

Relative importing is again supported.

2 years agoHTTP: fixed stub_status statistic when js_periodic is enabled.
Dmitry Volyntsev [Thu, 1 Feb 2024 01:06:58 +0000 (17:06 -0800)]
HTTP: fixed stub_status statistic when js_periodic is enabled.

Previously, when js_periodic is enabled the Reading statistic
was growing each time the js_periodic handler was called.

The issue was introduced in f1bd0b1db065 (0.8.1).

This fixes #692 issue on Github.

2 years agoStyle.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:08 +0000 (17:16 -0800)]
Style.

2 years ago2024 year.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:07 +0000 (17:16 -0800)]
2024 year.

2 years agoTest262: handling the mkdir issue with a host file system.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:01 +0000 (17:16 -0800)]
Test262: handling the mkdir issue with a host file system.

2 years agoFixed parsing of hex, oct and binary literals with no digits.
Vadim Zhestikov [Mon, 29 Jan 2024 16:57:49 +0000 (08:57 -0800)]
Fixed parsing of hex, oct and binary literals with no digits.

2 years agoFixed parsing of for-statement.
Vadim Zhestikov [Mon, 29 Jan 2024 16:57:48 +0000 (08:57 -0800)]
Fixed parsing of for-statement.

2 years agoFixed fuzzer build after 9b3dac56fd8a.
Dmitry Volyntsev [Thu, 25 Jan 2024 22:48:05 +0000 (14:48 -0800)]
Fixed fuzzer build after 9b3dac56fd8a.

2 years agoMoving out HostLoadImportedModule from njs core.
Dmitry Volyntsev [Wed, 24 Jan 2024 00:34:10 +0000 (16:34 -0800)]
Moving out HostLoadImportedModule from njs core.

HostLoadImportedModule should be implemented by host
environment according to ECMAScript specs.

The following method was removed: njs_vm_add_path().

2 years agoChange: imported modules are not resolved relative to current dir.
Dmitry Volyntsev [Wed, 24 Jan 2024 00:33:52 +0000 (16:33 -0800)]
Change: imported modules are not resolved relative to current dir.

Previously, when a module was imported with a relative path
it was looked for first in the directory of the importing context
(global, or a module).

For example when:
    main.js:
        import libs/lib1.js;

    libs/lib1.js:
        import lib2.js;

lib2.js was looked for first in libs/.

Now, it is only looked for in directories speficied with js_path
and a directory of nginx configuration file.

2 years agoShell: fixed unhandled rejected promises handling.
Dmitry Volyntsev [Wed, 24 Jan 2024 00:33:29 +0000 (16:33 -0800)]
Shell: fixed unhandled rejected promises handling.

The issue was introduced in dffdf7c50dfc (not released yet).

2 years agoMoving out HostPromiseRejectionTracker from njs core.
Dmitry Volyntsev [Fri, 19 Jan 2024 02:03:35 +0000 (18:03 -0800)]
Moving out HostPromiseRejectionTracker from njs core.

HostPromiseRejectionTracker should be implemented by host
environment according to ECMAScript specs.

The following method was removed: njs_vm_unhandled_rejection().
The following method was introduced: njs_vm_set_rejection_tracker().

2 years agoFixed tracking of unhandled rejected promises.
Dmitry Volyntsev [Fri, 19 Jan 2024 02:03:24 +0000 (18:03 -0800)]
Fixed tracking of unhandled rejected promises.

Checking for unhandled promise rejections while looping for pending jobs
produces false-positive reports when an rejected promised is handled
by one of the pending jobs later.

The fix is to check for unhandled promise rejections only at top level
calls like ngx_js_name_invoke() and ngx_js_name_call() and only after
all pending jobs are processed.

The issue was introduced in bc80bcb3102c (not released yet).

2 years agoHTTP: avoiding arithmetic ops with NULL pointer in r.args getter.
Dmitry Volyntsev [Thu, 11 Jan 2024 23:13:47 +0000 (15:13 -0800)]
HTTP: avoiding arithmetic ops with NULL pointer in r.args getter.

Found by UndefinedBehaviorSanitizer.

2 years agoQueryString: avoiding arithmetic ops with NULL in parse().
Dmitry Volyntsev [Thu, 11 Jan 2024 23:13:43 +0000 (15:13 -0800)]
QueryString: avoiding arithmetic ops with NULL in parse().

Found by UndefinedBehaviorSanitizer.

2 years agoRemoved unused field from njs_vmcode_t.
Vadim Zhestikov [Thu, 11 Jan 2024 00:26:35 +0000 (16:26 -0800)]
Removed unused field from njs_vmcode_t.

2 years agoFixed potential buffer overread in String.prototype.match().
Dmitry Volyntsev [Wed, 10 Jan 2024 01:56:19 +0000 (17:56 -0800)]
Fixed potential buffer overread in String.prototype.match().

2 years agoAvoiding arithmetic ops with NULL in %TypedArray%.prototype.sort().
Dmitry Volyntsev [Tue, 9 Jan 2024 17:14:42 +0000 (09:14 -0800)]
Avoiding arithmetic ops with NULL in %TypedArray%.prototype.sort().

Found by UndefinedBehaviorSanitizer.

2 years agoAvoiding casting Infinity to integer in String.fromCodePoint().
Dmitry Volyntsev [Tue, 9 Jan 2024 06:21:14 +0000 (22:21 -0800)]
Avoiding casting Infinity to integer in String.fromCodePoint().

Found by UndefinedBehaviorSanitizer.

2 years agoAvoiding arithmetic operations with NULL pointer in TextDecoder().
Dmitry Volyntsev [Tue, 9 Jan 2024 06:20:19 +0000 (22:20 -0800)]
Avoiding arithmetic operations with NULL pointer in TextDecoder().

Found by UndefinedBehaviorSanitizer.

2 years agoAvoiding casting NaN value to int64_t in njs.dump().
Dmitry Volyntsev [Tue, 9 Jan 2024 06:20:10 +0000 (22:20 -0800)]
Avoiding casting NaN value to int64_t in njs.dump().

Found by UndefinedBehaviorSanitizer.

2 years agoAvoiding pointer wraparound for padded integer specifier.
Dmitry Volyntsev [Tue, 9 Jan 2024 06:19:59 +0000 (22:19 -0800)]
Avoiding pointer wraparound for padded integer specifier.

Previously, when integer was larger than the padded width in a integer
specifier, the "end" pointer was evaluated to a value before "buf"
pointer.

Found by UndefinedBehaviorSanitizer.

2 years agoIgnoring UndefinedBehaviorSanitizer warnings where appropriate.
Dmitry Volyntsev [Sun, 30 Jul 2023 09:21:51 +0000 (10:21 +0100)]
Ignoring UndefinedBehaviorSanitizer warnings where appropriate.

Prodded by David Carlier and Ben Kallus.