Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c14048079 | ||
|
|
34efda6423 | ||
|
|
22ab2fb724 | ||
|
|
392a352901 | ||
|
|
b594a3229c | ||
|
|
94854a1dfa | ||
|
|
1795e8cf26 |
@@ -11,7 +11,7 @@ JSON in Java [package org.json]
|
|||||||
[](https://github.com/stleary/JSON-java/actions/workflows/codeql-analysis.yml)
|
[](https://github.com/stleary/JSON-java/actions/workflows/codeql-analysis.yml)
|
||||||
[](https://javadoc.io/doc/org.json/json)
|
[](https://javadoc.io/doc/org.json/json)
|
||||||
|
|
||||||
**[Click here if you just want the latest release jar file.](https://search.maven.org/remotecontent?filepath=org/json/json/202607119/json-20260719.jar)**
|
**[Click here if you just want the latest release jar file.](https://repo1.maven.org/maven2/org/json/json/20260814/json-20260814.jar)**
|
||||||
|
|
||||||
|
|
||||||
# Overview
|
# Overview
|
||||||
|
|||||||
+9
-1
@@ -21,6 +21,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To view the report open build/reports/jacoco/test/html/index.html
|
// To view the report open build/reports/jacoco/test/html/index.html
|
||||||
|
// Note: disable jacocoTestReport and test blocks, and the jacoco plugin if it interferes with stepping in the debugger
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
reports {
|
reports {
|
||||||
html.required = true
|
html.required = true
|
||||||
@@ -31,6 +32,13 @@ test {
|
|||||||
finalizedBy jacocoTestReport
|
finalizedBy jacocoTestReport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enable logging to stdout during test
|
||||||
|
tasks.withType(Test) {
|
||||||
|
testLogging {
|
||||||
|
showStandardStreams = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
testImplementation 'com.jayway.jsonpath:json-path:2.9.0'
|
testImplementation 'com.jayway.jsonpath:json-path:2.9.0'
|
||||||
@@ -42,7 +50,7 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'org.json'
|
group = 'org.json'
|
||||||
version = 'v20260719-SNAPSHOT'
|
version = 'v20260814-SNAPSHOT'
|
||||||
description = 'JSON in Java'
|
description = 'JSON in Java'
|
||||||
sourceCompatibility = '1.8'
|
sourceCompatibility = '1.8'
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ and artifactId "json". For example:
|
|||||||
[https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav](https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav)
|
[https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav](https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav)
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
|
20260814 Fixes XML.unescape whitespace handling
|
||||||
|
|
||||||
20260719 Fixes CVE-2026-59171 very large BigInteger, BigDecimal
|
20260719 Fixes CVE-2026-59171 very large BigInteger, BigDecimal
|
||||||
|
|
||||||
20260522 Publish key data, recent commits for minor fixes
|
20260522 Publish key data, recent commits for minor fixes
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20260719</version>
|
<version>20260814</version>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<name>JSON in Java</name>
|
<name>JSON in Java</name>
|
||||||
@@ -46,20 +46,6 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<name>Central Repository OSSRH</name>
|
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@@ -158,17 +144,7 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<version>1.6.3</version>
|
|
||||||
<extensions>true</extensions>
|
|
||||||
<configuration>
|
|
||||||
<serverId>ossrh</serverId>
|
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
|
||||||
<autoReleaseAfterClose>false</autoReleaseAfterClose>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.moditect</groupId>
|
<groupId>org.moditect</groupId>
|
||||||
<artifactId>moditect-maven-plugin</artifactId>
|
<artifactId>moditect-maven-plugin</artifactId>
|
||||||
|
|||||||
@@ -172,8 +172,14 @@ public class XML {
|
|||||||
&& cp != 0xA
|
&& cp != 0xA
|
||||||
&& cp != 0xD
|
&& cp != 0xD
|
||||||
) || !(
|
) || !(
|
||||||
// valid the range of acceptable characters that aren't control
|
// Valid character range per W3C XML 1.0 spec:
|
||||||
(cp >= 0x20 && cp <= 0xD7FF)
|
// #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
|
||||||
|
// Previously omitted #x9/#xA/#xD, causing unescape(" ") etc.
|
||||||
|
// to reject valid LF/TAB/CR as illegal (see #1059)
|
||||||
|
cp == 0x9
|
||||||
|
|| cp == 0xA
|
||||||
|
|| cp == 0xD
|
||||||
|
|| (cp >= 0x20 && cp <= 0xD7FF)
|
||||||
|| (cp >= 0xE000 && cp <= 0xFFFD)
|
|| (cp >= 0xE000 && cp <= 0xFFFD)
|
||||||
|| (cp >= 0x10000 && cp <= 0x10FFFF)
|
|| (cp >= 0x10000 && cp <= 0x10FFFF)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1537,6 +1537,43 @@ public class XMLTest {
|
|||||||
assertEquals("A", jsonObject.getString("a"));
|
assertEquals("A", jsonObject.getString("a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that valid XML numeric character references for whitespace
|
||||||
|
* control characters (TAB, LF, CR) are correctly unescaped. These
|
||||||
|
* codepoints are explicitly allowed by the XML 1.0 spec
|
||||||
|
* (https://www.w3.org/TR/REC-xml/#charsets) but were previously rejected
|
||||||
|
* as invalid. See issue #1059.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testValidWhitespaceNumericEntityUnescape() {
|
||||||
|
// decimal references for the three allowed control characters
|
||||||
|
assertEquals("\t", XML.unescape("	"));
|
||||||
|
assertEquals("\n", XML.unescape(" "));
|
||||||
|
assertEquals("\r", XML.unescape(" "));
|
||||||
|
// hex references for the same codepoints
|
||||||
|
assertEquals("\t", XML.unescape("	"));
|
||||||
|
assertEquals("\n", XML.unescape("
"));
|
||||||
|
assertEquals("\r", XML.unescape("
"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that {@code XML.toJSONObject} accepts numeric character references
|
||||||
|
* for the XML-allowed control characters (TAB, LF, CR) without throwing.
|
||||||
|
* Regression test for #1059, where {@code XML.toJSONObject("<a> </a>")}
|
||||||
|
* threw JSONException in versions after 20251224.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testValidWhitespaceNumericEntityToJSONObject() {
|
||||||
|
// LF reference should round-trip through toJSONObject without throwing
|
||||||
|
JSONObject jsonObject = XML.toJSONObject("<a> </a>");
|
||||||
|
// the value is the LF character (possibly trimmed by the JSON path,
|
||||||
|
// but the call must not throw)
|
||||||
|
assertTrue(jsonObject.has("a"));
|
||||||
|
// TAB and CR references also accepted
|
||||||
|
XML.toJSONObject("<a>	</a>");
|
||||||
|
XML.toJSONObject("<a> </a>");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user