Skip to content

Commit c2ea817

Browse files
committed
refactor(jsonrpc): narrow parsing catch to JsonProcessingException
Request bodies that are not well-formed UTF-8 or that contain a NUL byte are rejected before parsing, so the parser only sees UTF-8 input held in memory and reports every failure as a JsonProcessingException. Go back to catching that type. The try block still covers only the parse call. No behavior change.
1 parent bf6d23a commit c2ea817

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎framework/src/main/java/org/tron/core/services/jsonrpc/JsonRpcServlet.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ private void doPostInternal(HttpServletRequest req, HttpServletResponse resp) th
134134
JsonNode rootNode;
135135
try {
136136
rootNode = REQUEST_READER.readTree(body);
137-
} catch (IOException e) {
138-
// The body is already in memory, so an IOException here is a decoding failure.
137+
} catch (JsonProcessingException e) {
139138
String message = e instanceof StreamConstraintsException
140139
? e.getMessage() : "JSON parse error";
141140
writeJsonRpcError(resp, JsonRpcError.PARSE_ERROR, message, null, false);

0 commit comments

Comments
 (0)