Comments (3)
Can you submit a simple test-case please?
from jettison.
Sure, here it is:
public static void main(String[] args) throws JSONException {
var jsonMap = Map.of("request", "{\"exclude\":[\".\",\"?\",\"+\",\"*\",\"|\",\"{\",\"}\",\"[\",\"]\",\"(\",\")\",\"\\\"\",\"\\\\\",\"#\",\"@\",\"&\",\"<\",\">\",\"~\"]}");
JSONObject jsonObject = new JSONObject(jsonMap);
JSONObject jsonObject1 = new JSONObject(jsonObject.toString());
}
So a text field contains valid JSON with escaped backslash. It's possible to create JSONObject from this input but if you look at its text representation then you can see that it's invalid. So if we try to create one more JSONObject from this string then we fail with org.codehaus.jettison.json.JSONException: Missing value. at character 109
.
JSON text:
{"request":"{\"exclude\":[\".\",\"?\",\"+\",\"*\",\"|\",\"{\",\"}\",\"[\",\"]\",\"(\",\")\",\"\\\"\",\"\\\\",\"#\",\"@\",\"&\",\"<\",\">\",\"~\"]}"}
If we run the same code on 1.5.1 it works without any issues.
JSON text:
{"request":"{\"exclude\":[\".\",\"?\",\"+\",\"*\",\"|\",\"{\",\"}\",\"[\",\"]\",\"(\",\")\",\"\\\"\",\"\\\\\",\"#\",\"@\",\"&\",\"<\",\">\",\"~\"]}"}
The difference is in \"\\\\"
(incorrect) vs \"\\\\\"
(correct).
from jettison.
Fixed by 631c21e
from jettison.
Related Issues (20)
- improve "A JSONObject text must begin with '{' at character 1 of" error message HOT 3
- Infinite loop in the parser finally leading to Stack Overflow HOT 1
- Question on backward compatibility of 1.5.1 release with 1.4.x and 1.3.7
- If the value in map is the map's self, the new new JSONObject(map) cause StackOverflowError which may lead to dos HOT 2
- Find a StackOverflowError in jettison HOT 2
- BDSA-2022-3278 was detected by security scan tool HOT 1
- Please revert the recursion depth default limit as the retardation it is. HOT 1
- Incorrect recursion depth check in JSONTokener in 1.5.2 causes it to fail for inputs with low recursion depth HOT 1
- If the value inside a Collection is itself, using it with JSONArray causes a StackOverflowError which may lead to DoS HOT 1
- JSON formatter/builders don't support all the data types defined in the JSON spec
- upgraded jettison 1.5.1 to 1.5.2 , throwing error were JSONObject used and force to handle try/catch or surround with JSONException HOT 1
- NoClassDefFoundError Exception with jettison 1.5.3
- Security scan tool (Black Duck Binary Analysis) detected CVE-2022-45688, is the latest version 1.5.4 really affected by this vulnerability? HOT 2
- optXXX() should return default value instead of throwing a RuntimeException
- Jettison serialize array object as like json object when array object contains only one element in it.
- Question on breaking change or incompatibility between version 1.2 and 1.5.4 HOT 1
- Security scan tool (Black Duck Binary Analysis) detected CVE-2023-5072, is the latest version 1.5.4 really affected by this vulnerability? HOT 2
- A OOM problem was found in jettison
- Jettison compatibility with JDK 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jettison.