git: 088e1f2952ac - main - www/nginx-module-njs: Fix indexed fast paths for exotic objects
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 09 Sep 2026 16:37:58 UTC
The branch main has been updated by joneum:
URL: https://cgit.FreeBSD.org/ports/commit/?id=088e1f2952ace9a6f7b779b7c09530b24a85a4d8
commit 088e1f2952ace9a6f7b779b7c09530b24a85a4d8
Author: Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-09-09 16:36:03 +0000
Commit: Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-09-09 16:37:46 +0000
www/nginx-module-njs: Fix indexed fast paths for exotic objects
Object.values() and Object.entries() erased the concrete type of an
exotic receiver, so typed arrays could be treated as njs_array_t and
cause invalid memory reads and writes. Taken from upstream commit
bb6f23cc, which is not in a release yet.
Sponsored by: Netzkommune GmbH
---
www/nginx-module-njs/Makefile | 1 +
www/nginx-module-njs/files/patch-src_njs__object.c | 11 ++++++++++
www/nginx-module-njs/files/patch-src_njs__value.c | 24 ++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/www/nginx-module-njs/Makefile b/www/nginx-module-njs/Makefile
index 1edd9b134872..e5853a66cfb1 100644
--- a/www/nginx-module-njs/Makefile
+++ b/www/nginx-module-njs/Makefile
@@ -1,5 +1,6 @@
PORTNAME= nginx-module-njs
DISTVERSION= 1.0.1
+PORTREVISION= 1
CATEGORIES= www
MAINTAINER= joneum@FreeBSD.org
diff --git a/www/nginx-module-njs/files/patch-src_njs__object.c b/www/nginx-module-njs/files/patch-src_njs__object.c
new file mode 100644
index 000000000000..d3a66887340c
--- /dev/null
+++ b/www/nginx-module-njs/files/patch-src_njs__object.c
@@ -0,0 +1,11 @@
+--- src/njs_object.c.orig 2026-08-20 18:32:42 UTC
++++ src/njs_object.c
+@@ -1140,7 +1140,7 @@ njs_object_own_enumerate_object(njs_vm_t *vm, const nj
+ }
+
+ entry = NULL;
+- njs_set_object(&value, (njs_object_t *) object);
++ njs_set_type_object(&value, (njs_object_t *) object, object->type);
+
+ for (i = 0; i< items_sorted->length; i++) {
+ ret = njs_value_property_val(vm, &value, &items_sorted->start[i],
diff --git a/www/nginx-module-njs/files/patch-src_njs__value.c b/www/nginx-module-njs/files/patch-src_njs__value.c
new file mode 100644
index 000000000000..84b4cd672d74
--- /dev/null
+++ b/www/nginx-module-njs/files/patch-src_njs__value.c
@@ -0,0 +1,24 @@
+--- src/njs_value.c.orig 2026-08-20 18:32:42 UTC
++++ src/njs_value.c
+@@ -1075,9 +1075,7 @@ njs_value_property(njs_vm_t *vm, njs_value_t *value, u
+ return NJS_OK;
+ }
+
+- if (njs_slow_path(!(njs_is_object(value)
+- && njs_object(value)->fast_array)))
+- {
++ if (njs_slow_path(!njs_is_fast_array(value))) {
+ goto slow_path;
+ }
+
+@@ -1194,9 +1192,7 @@ njs_value_property_set(njs_vm_t *vm, njs_value_t *valu
+ return NJS_OK;
+ }
+
+- if (njs_slow_path(!(njs_is_object(value)
+- && njs_object(value)->fast_array)))
+- {
++ if (njs_slow_path(!njs_is_fast_array(value))) {
+ goto slow_path;
+ }
+