From 727d2de967dcc8827153688e06998402ace42e65 Mon Sep 17 00:00:00 2001
From: Ojo Kayode Julius <93586369+kayodeo1@users.noreply.github.com>
Date: Fri, 27 Nov 2026 10:38:52 +0100
Subject: [PATCH 1/5] Allow '#' inside json-pointer and relative-json-pointer
tokens
RFC 6901 section 3 lets a reference token contain any character except
'/' and '~' (escaped as ~0 and ~1), so "/a#b" is a valid JSON Pointer.
The json-pointer and relative-json-pointer patterns also excluded '#',
so format assertions rejected such pointers. Only the URI fragment
representation (section 6) starts with '#', and that form is still
rejected because a JSON Pointer must start with '/'.
---
.../com/networknt/schema/format/Formats.java | 4 +-
.../schema/format/JsonPointerFormatTest.java | 71 +++++++++++++++++++
2 files changed, 73 insertions(+), 2 deletions(-)
create mode 100644 src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
diff --git a/src/main/java/com/networknt/schema/format/Formats.java b/src/main/java/com/networknt/schema/format/Formats.java
index a3c646c2a..3f592c40f 100644
--- a/src/main/java/com/networknt/schema/format/Formats.java
+++ b/src/main/java/com/networknt/schema/format/Formats.java
@@ -72,8 +72,8 @@ static PatternFormat pattern(String name, String regex) {
formats.add(new HostnameFormat());
formats.add(pattern("ipv4", "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$", "format.ipv4"));
formats.add(new IPv6Format());
- formats.add(pattern("json-pointer", "^(/([^/#~]|[~](?=[01]))*)*$", "format.json-pointer"));
- formats.add(pattern("relative-json-pointer", "^(0|([1-9]\\d*))(#|(/([^/#~]|[~](?=[01]))*)*)$", "format.relative-json-pointer"));
+ formats.add(pattern("json-pointer", "^(/([^/~]|[~](?=[01]))*)*$", "format.json-pointer"));
+ formats.add(pattern("relative-json-pointer", "^(0|([1-9]\\d*))(#|(/([^/~]|[~](?=[01]))*)*)$", "format.relative-json-pointer"));
formats.add(pattern("uri-template", "^(?:" + URI_TEMPLATE_LITERALS + "|%\\p{XDigit}{2}|\\{[+#./;?&=,!@|]?" + URI_TEMPLATE_VARSPEC + "(?:," + URI_TEMPLATE_VARSPEC + ")*+\\})*+$", "format.uri-template"));
formats.add(pattern("uuid", "^\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}$", "format.uuid"));
formats.add(new DateFormat());
diff --git a/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
new file mode 100644
index 000000000..147278681
--- /dev/null
+++ b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2026 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.networknt.schema.format;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.List;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import com.networknt.schema.Error;
+import com.networknt.schema.InputFormat;
+import com.networknt.schema.Schema;
+import com.networknt.schema.SchemaRegistry;
+import com.networknt.schema.SpecificationVersion;
+
+/**
+ * Tests for the json-pointer and relative-json-pointer formats.
+ *
+ * RFC 6901 section 3: a reference token may contain any character except '/' and '~', which is escaped as '~0' or
+ * '~1'. A '#' is an ordinary character inside a token; only the URI fragment representation (section 6) starts with
+ * '#', and that is not a JSON Pointer string.
+ */
+class JsonPointerFormatTest {
+
+ private static boolean valid(String format, String value) {
+ Schema schema = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_2020_12)
+ .getSchema("{\"type\": \"string\", \"format\": \"" + format + "\"}");
+ List errors = schema.validate("\"" + value + "\"", InputFormat.JSON,
+ executionContext -> executionContext.executionConfig(config -> config.formatAssertionsEnabled(true)));
+ return errors.isEmpty();
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "", "/", "/foo", "/a#b", "/#", "/foo#bar/baz", "/~0#~1", "/c%d/e^f/g|h" })
+ void jsonPointerAccepts(String value) {
+ assertEquals(true, valid("json-pointer", value), value);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "#", "#/", "#/a", "a#b", "/a~2#", "/~#" })
+ void jsonPointerRejects(String value) {
+ assertEquals(false, valid("json-pointer", value), value);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "0", "0#", "1/foo", "0/a#b", "2/#", "10/foo#bar" })
+ void relativeJsonPointerAccepts(String value) {
+ assertEquals(true, valid("relative-json-pointer", value), value);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "#/a", "/a#b", "01/a", "0/a~2#", "0##" })
+ void relativeJsonPointerRejects(String value) {
+ assertEquals(false, valid("relative-json-pointer", value), value);
+ }
+}
From 3328f397408643086085e41d80926cfffd764db3 Mon Sep 17 00:00:00 2001
From: Ojo Kayode Julius <93586369+kayodeo1@users.noreply.github.com>
Date: Fri, 27 Nov 2026 20:55:56 +0100
Subject: [PATCH 2/5] Match json-pointer tokens possessively to avoid a stack
overflow
With format assertions on, a long reference token, such as "/" followed
by 5,000 characters as json-pointer or "0/" followed by them as
relative-json-pointer, made validation throw StackOverflowError: the
regex engine recursed once per character on the token group.
Both patterns now share one JSON Pointer sub-pattern with possessive
groups, as uri-template already uses. A token can be split into
characters and ~0/~1 escapes only one way, so the possessive form
accepts the same values; a 100,000-character token now validates.
---
.../com/networknt/schema/format/Formats.java | 14 ++++++--
.../schema/format/JsonPointerFormatTest.java | 33 +++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/networknt/schema/format/Formats.java b/src/main/java/com/networknt/schema/format/Formats.java
index 3f592c40f..99bfc47c3 100644
--- a/src/main/java/com/networknt/schema/format/Formats.java
+++ b/src/main/java/com/networknt/schema/format/Formats.java
@@ -64,6 +64,16 @@ static PatternFormat pattern(String name, String regex) {
private static final String URI_TEMPLATE_VARSPEC = "(?:\\w++|%\\p{XDigit}{2})++"
+ "(?:\\.(?:\\w++|%\\p{XDigit}{2})++)*+(?::[1-9]\\d{0,3}|\\*)?";
+ /**
+ * An RFC 6901 JSON Pointer: reference tokens, each preceded by {@code /}, whose characters are anything but
+ * {@code /} and {@code ~}, or the escapes {@code ~0} and {@code ~1}.
+ *
+ * A token can be split into characters and escapes only one way, so the groups are possessive, as in
+ * {@link #URI_TEMPLATE_LITERALS}: the regex engine does not recurse once per character, and a long token cannot
+ * overflow the stack.
+ */
+ private static final String JSON_POINTER = "(?:/(?:[^/~]|~[01])*+)*+";
+
public static final List DEFAULT;
static {
@@ -72,8 +82,8 @@ static PatternFormat pattern(String name, String regex) {
formats.add(new HostnameFormat());
formats.add(pattern("ipv4", "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$", "format.ipv4"));
formats.add(new IPv6Format());
- formats.add(pattern("json-pointer", "^(/([^/~]|[~](?=[01]))*)*$", "format.json-pointer"));
- formats.add(pattern("relative-json-pointer", "^(0|([1-9]\\d*))(#|(/([^/~]|[~](?=[01]))*)*)$", "format.relative-json-pointer"));
+ formats.add(pattern("json-pointer", "^" + JSON_POINTER + "$", "format.json-pointer"));
+ formats.add(pattern("relative-json-pointer", "^(?:0|[1-9]\\d*+)(?:#|" + JSON_POINTER + ")$", "format.relative-json-pointer"));
formats.add(pattern("uri-template", "^(?:" + URI_TEMPLATE_LITERALS + "|%\\p{XDigit}{2}|\\{[+#./;?&=,!@|]?" + URI_TEMPLATE_VARSPEC + "(?:," + URI_TEMPLATE_VARSPEC + ")*+\\})*+$", "format.uri-template"));
formats.add(pattern("uuid", "^\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}$", "format.uuid"));
formats.add(new DateFormat());
diff --git a/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
index 147278681..9e1c1c1d5 100644
--- a/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
+++ b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
@@ -19,6 +19,7 @@
import java.util.List;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -68,4 +69,36 @@ void relativeJsonPointerAccepts(String value) {
void relativeJsonPointerRejects(String value) {
assertEquals(false, valid("relative-json-pointer", value), value);
}
+
+ private static String repeat(String s, int count) {
+ StringBuilder sb = new StringBuilder(s.length() * count);
+ for (int i = 0; i < count; i++) {
+ sb.append(s);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * The token and pointer groups are possessive, so the regex engine does not recurse once per character and a long
+ * token cannot overflow the stack.
+ */
+ @ParameterizedTest
+ @ValueSource(ints = { 5_000, 100_000 })
+ void longTokensDoNotOverflow(int length) {
+ String token = repeat("a", length);
+ assertEquals(true, valid("json-pointer", "/" + token));
+ assertEquals(true, valid("json-pointer", "/" + repeat("a~0#", length / 4)));
+ assertEquals(false, valid("json-pointer", "/" + token + "~2"));
+ assertEquals(true, valid("json-pointer", repeat("/a", length / 2)));
+ assertEquals(true, valid("relative-json-pointer", "0/" + token));
+ assertEquals(true, valid("relative-json-pointer", "1" + repeat("/a~1", length / 4)));
+ assertEquals(false, valid("relative-json-pointer", "0/" + token + "~"));
+ assertEquals(true, valid("relative-json-pointer", "0" + repeat("/a", length / 2)));
+ }
+
+ @Test
+ void longTokenRejectedWithoutOverflow() {
+ assertEquals(false, valid("json-pointer", repeat("a", 100_000)));
+ assertEquals(false, valid("relative-json-pointer", "01/" + repeat("a", 100_000)));
+ }
}
From cce7a7a68b3194defbaeca7a88ddeeb20510de58 Mon Sep 17 00:00:00 2001
From: Ojo Kayode Julius <93586369+kayodeo1@users.noreply.github.com>
Date: Fri, 27 Nov 2026 20:57:15 +0100
Subject: [PATCH 3/5] Accept relative-json-pointer index manipulation in
2020-12
Draft 2020-12 references draft-bhutton-relative-json-pointer-00, whose
origin-specification may end with an index manipulation,
("+" / "-") positive-integer, so 0+1/foo and 1-1# are valid there. The
earlier drafts reference draft-handrews-relative-json-pointer, which has
no index manipulation.
The format list is shared by all dialects, so relative-json-pointer is
now a RelativeJsonPointerFormat that reads the specification version from
the schema context, like BaseFormatValidator does, and allows the index
manipulation only for 2020-12. +1/foo/bar, -1/foo/bar, 0+0 and 0-01 stay
invalid, and nothing changes for draft 4 to 2019-09.
---
.../com/networknt/schema/format/Formats.java | 4 +-
.../format/RelativeJsonPointerFormat.java | 67 +++++++++++++++++++
.../schema/format/JsonPointerFormatTest.java | 39 ++++++++++-
3 files changed, 107 insertions(+), 3 deletions(-)
create mode 100644 src/main/java/com/networknt/schema/format/RelativeJsonPointerFormat.java
diff --git a/src/main/java/com/networknt/schema/format/Formats.java b/src/main/java/com/networknt/schema/format/Formats.java
index 99bfc47c3..2795e02f3 100644
--- a/src/main/java/com/networknt/schema/format/Formats.java
+++ b/src/main/java/com/networknt/schema/format/Formats.java
@@ -72,7 +72,7 @@ static PatternFormat pattern(String name, String regex) {
* {@link #URI_TEMPLATE_LITERALS}: the regex engine does not recurse once per character, and a long token cannot
* overflow the stack.
*/
- private static final String JSON_POINTER = "(?:/(?:[^/~]|~[01])*+)*+";
+ static final String JSON_POINTER = "(?:/(?:[^/~]|~[01])*+)*+";
public static final List DEFAULT;
@@ -83,7 +83,7 @@ static PatternFormat pattern(String name, String regex) {
formats.add(pattern("ipv4", "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$", "format.ipv4"));
formats.add(new IPv6Format());
formats.add(pattern("json-pointer", "^" + JSON_POINTER + "$", "format.json-pointer"));
- formats.add(pattern("relative-json-pointer", "^(?:0|[1-9]\\d*+)(?:#|" + JSON_POINTER + ")$", "format.relative-json-pointer"));
+ formats.add(new RelativeJsonPointerFormat());
formats.add(pattern("uri-template", "^(?:" + URI_TEMPLATE_LITERALS + "|%\\p{XDigit}{2}|\\{[+#./;?&=,!@|]?" + URI_TEMPLATE_VARSPEC + "(?:," + URI_TEMPLATE_VARSPEC + ")*+\\})*+$", "format.uri-template"));
formats.add(pattern("uuid", "^\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}$", "format.uuid"));
formats.add(new DateFormat());
diff --git a/src/main/java/com/networknt/schema/format/RelativeJsonPointerFormat.java b/src/main/java/com/networknt/schema/format/RelativeJsonPointerFormat.java
new file mode 100644
index 000000000..79a9c2c09
--- /dev/null
+++ b/src/main/java/com/networknt/schema/format/RelativeJsonPointerFormat.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2026 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.networknt.schema.format;
+
+import java.util.regex.Pattern;
+
+import com.networknt.schema.ExecutionContext;
+import com.networknt.schema.SchemaContext;
+import com.networknt.schema.SpecificationVersion;
+
+/**
+ * Format for relative-json-pointer.
+ *
+ * A non-negative integer, followed by {@code #} or a JSON Pointer. Draft 2020-12 references
+ * draft-bhutton-relative-json-pointer-00, which also allows an index manipulation after the integer,
+ * {@code ("+" / "-") positive-integer}, as in {@code 0+1/foo} or {@code 1-1#}. The earlier drafts reference
+ * draft-handrews-relative-json-pointer, which has no index manipulation, so it is accepted only when the dialect's
+ * specification version is 2020-12 or later.
+ */
+public class RelativeJsonPointerFormat implements Format {
+ private static final String NON_NEGATIVE_INTEGER = "(?:0|[1-9]\\d*+)";
+ private static final String INDEX_MANIPULATION = "(?:[+-][1-9]\\d*+)?";
+ private static final String END = "(?:#|" + Formats.JSON_POINTER + ")";
+
+ private static final Pattern PATTERN = Pattern.compile("^" + NON_NEGATIVE_INTEGER + END + "$");
+ private static final Pattern PATTERN_INDEX_MANIPULATION = Pattern
+ .compile("^" + NON_NEGATIVE_INTEGER + INDEX_MANIPULATION + END + "$");
+
+ @Override
+ public boolean matches(ExecutionContext executionContext, String value) {
+ return PATTERN.matcher(value).matches();
+ }
+
+ @Override
+ public boolean matches(ExecutionContext executionContext, SchemaContext schemaContext, String value) {
+ SpecificationVersion specification = schemaContext != null && schemaContext.getDialect() != null
+ ? schemaContext.getDialect().getSpecificationVersion()
+ : null;
+ if (specification != null && specification.getOrder() >= SpecificationVersion.DRAFT_2020_12.getOrder()) {
+ return PATTERN_INDEX_MANIPULATION.matcher(value).matches();
+ }
+ return matches(executionContext, value);
+ }
+
+ @Override
+ public String getName() {
+ return "relative-json-pointer";
+ }
+
+ @Override
+ public String getMessageKey() {
+ return "format.relative-json-pointer";
+ }
+}
diff --git a/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
index 9e1c1c1d5..c41c743cf 100644
--- a/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
+++ b/src/test/java/com/networknt/schema/format/JsonPointerFormatTest.java
@@ -39,7 +39,11 @@
class JsonPointerFormatTest {
private static boolean valid(String format, String value) {
- Schema schema = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_2020_12)
+ return valid(SpecificationVersion.DRAFT_2020_12, format, value);
+ }
+
+ private static boolean valid(SpecificationVersion version, String format, String value) {
+ Schema schema = SchemaRegistry.withDefaultDialect(version)
.getSchema("{\"type\": \"string\", \"format\": \"" + format + "\"}");
List errors = schema.validate("\"" + value + "\"", InputFormat.JSON,
executionContext -> executionContext.executionConfig(config -> config.formatAssertionsEnabled(true)));
@@ -70,6 +74,39 @@ void relativeJsonPointerRejects(String value) {
assertEquals(false, valid("relative-json-pointer", value), value);
}
+ /**
+ * 2020-12 references draft-bhutton-relative-json-pointer-00, whose origin-specification may end with an index
+ * manipulation: {@code ("+" / "-") positive-integer}.
+ */
+ @ParameterizedTest
+ @ValueSource(strings = { "0+1/foo", "1-1#", "0+1", "2-1/a#b", "10+20#", "0-1/" })
+ void relativeJsonPointerIndexManipulationAcceptedIn202012(String value) {
+ assertEquals(true, valid(SpecificationVersion.DRAFT_2020_12, "relative-json-pointer", value), value);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "+1/foo/bar", "-1/foo/bar", "0+0", "0-01", "0+", "0-", "0+1+1", "0++1", "01+1", "0+1##" })
+ void relativeJsonPointerInvalidIndexManipulationRejectedIn202012(String value) {
+ assertEquals(false, valid(SpecificationVersion.DRAFT_2020_12, "relative-json-pointer", value), value);
+ }
+
+ /**
+ * Drafts 7 and 2019-09 reference draft-handrews-relative-json-pointer, which has no index manipulation.
+ */
+ @ParameterizedTest
+ @ValueSource(strings = { "0+1/foo", "1-1#", "0+1" })
+ void relativeJsonPointerIndexManipulationRejectedBefore202012(String value) {
+ assertEquals(false, valid(SpecificationVersion.DRAFT_2019_09, "relative-json-pointer", value), value);
+ assertEquals(false, valid(SpecificationVersion.DRAFT_7, "relative-json-pointer", value), value);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "0", "0#", "1/foo", "0/a#b", "10/foo#bar" })
+ void relativeJsonPointerWithoutIndexManipulationAcceptedBefore202012(String value) {
+ assertEquals(true, valid(SpecificationVersion.DRAFT_2019_09, "relative-json-pointer", value), value);
+ assertEquals(true, valid(SpecificationVersion.DRAFT_7, "relative-json-pointer", value), value);
+ }
+
private static String repeat(String s, int count) {
StringBuilder sb = new StringBuilder(s.length() * count);
for (int i = 0; i < count; i++) {
From b32d58a09bafdf9e6dda02f30c8a253f2b5d7d62 Mon Sep 17 00:00:00 2001
From: Ojo Kayode Julius <93586369+kayodeo1@users.noreply.github.com>
Date: Fri, 27 Nov 2026 20:57:25 +0100
Subject: [PATCH 4/5] Document the json-pointer and relative-json-pointer
changes in the changelog
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d9def139..87075feae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,8 @@ This project does not adhere to [Semantic Versioning](https://semver.org/) and m
- `idn-hostname` does not apply UTS 46 mapping.
- Removed the unused `UnicodeDatabase.isGreek`, `isHebrew` and `isKatakana`, which tested code blocks rather than scripts.
- Updated the vendored `hostname.json` and `idn-hostname.json` suite files to the current JSON-Schema-Test-Suite, including `draft-next`. Cases that need UTS 46 mapping are disabled with a reason.
+- `json-pointer` and `relative-json-pointer` accept `#` inside a reference token, as RFC 6901 section 3 allows: `/a#b`, `/#` and `0/a#b` are now valid, where 3.0.9 rejected them. A value that starts with `#` (the URI fragment form), such as `#/a`, remains invalid as `json-pointer`. Both formats match tokens possessively, so a long token, such as `/` followed by 100,000 characters, no longer makes validation throw `StackOverflowError`.
+- `relative-json-pointer` accepts an index manipulation after the integer in the 2020-12 dialects (Draft 2020-12 and OpenAPI 3.1), as draft-bhutton-relative-json-pointer-00 allows: `0+1/foo` and `1-1#` are now valid there. `+1/foo/bar`, `-1/foo/bar`, `0+0` and `0-01` remain invalid, and the earlier dialects, whose drafts have no index manipulation, are unchanged. `relative-json-pointer` is now implemented by `RelativeJsonPointerFormat` instead of a `PatternFormat`.
### Fixed
- `uri`, `uri-reference`, `iri` and `iri-reference` check the value as it is when `java.net.URI` cannot parse it. Since JDK 25, the input of the `URISyntaxException` is trimmed, or empty, depending on the `jdk.includeInExceptions` security property, so `http://` with a leading space was accepted and `about:` could be rejected.
From cfe85aea9cbc4300e4b98d76da7b57f0ab115237 Mon Sep 17 00:00:00 2001
From: Ojo Kayode Julius <93586369+kayodeo1@users.noreply.github.com>
Date: Thu, 3 Dec 2026 17:53:47 +0100
Subject: [PATCH 5/5] Move the json-pointer StackOverflowError fix to its own
changelog entry
---
CHANGELOG.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 87075feae..3556189dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,12 +36,13 @@ This project does not adhere to [Semantic Versioning](https://semver.org/) and m
- `idn-hostname` does not apply UTS 46 mapping.
- Removed the unused `UnicodeDatabase.isGreek`, `isHebrew` and `isKatakana`, which tested code blocks rather than scripts.
- Updated the vendored `hostname.json` and `idn-hostname.json` suite files to the current JSON-Schema-Test-Suite, including `draft-next`. Cases that need UTS 46 mapping are disabled with a reason.
-- `json-pointer` and `relative-json-pointer` accept `#` inside a reference token, as RFC 6901 section 3 allows: `/a#b`, `/#` and `0/a#b` are now valid, where 3.0.9 rejected them. A value that starts with `#` (the URI fragment form), such as `#/a`, remains invalid as `json-pointer`. Both formats match tokens possessively, so a long token, such as `/` followed by 100,000 characters, no longer makes validation throw `StackOverflowError`.
+- `json-pointer` and `relative-json-pointer` accept `#` inside a reference token, as RFC 6901 section 3 allows: `/a#b`, `/#` and `0/a#b` are now valid, where 3.0.9 rejected them. A value that starts with `#` (the URI fragment form), such as `#/a`, remains invalid as `json-pointer`.
- `relative-json-pointer` accepts an index manipulation after the integer in the 2020-12 dialects (Draft 2020-12 and OpenAPI 3.1), as draft-bhutton-relative-json-pointer-00 allows: `0+1/foo` and `1-1#` are now valid there. `+1/foo/bar`, `-1/foo/bar`, `0+0` and `0-01` remain invalid, and the earlier dialects, whose drafts have no index manipulation, are unchanged. `relative-json-pointer` is now implemented by `RelativeJsonPointerFormat` instead of a `PatternFormat`.
### Fixed
- `uri`, `uri-reference`, `iri` and `iri-reference` check the value as it is when `java.net.URI` cannot parse it. Since JDK 25, the input of the `URISyntaxException` is trimmed, or empty, depending on the `jdk.includeInExceptions` security property, so `http://` with a leading space was accepted and `about:` could be rejected.
- `uri-template` no longer throws `StackOverflowError` on long templates, such as a 5,000-character literal or an expression with a 1,000-character variable name. Runs of literal and variable-name characters are matched without recursion.
+- `json-pointer` and `relative-json-pointer` no longer throw `StackOverflowError` with format assertions on when a reference token is long; 3.0.9 threw it at about 5,000 characters. Reference tokens are matched possessively, so a token of 100,000 characters is accepted too.
- Prevent descendant discriminator state from leaking between `oneOf` and `anyOf` branches in OpenAPI 3.0 and 3.1. [#1378](https://github.com/networknt/json-schema-validator/issues/1378)
## 3.0.9- 2026-11-03