This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 0f1713aebd Fix unused end <-> length confusion
0f1713aebd is described below
commit 0f1713aebd600b303da65df204f4e6cddb44e044
Author: remm <[email protected]>
AuthorDate: Wed May 27 11:02:54 2026 +0200
Fix unused end <-> length confusion
---
java/org/apache/tomcat/util/json/JSONFilter.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/util/json/JSONFilter.java
b/java/org/apache/tomcat/util/json/JSONFilter.java
index 3d4aff5f11..11710f1bee 100644
--- a/java/org/apache/tomcat/util/json/JSONFilter.java
+++ b/java/org/apache/tomcat/util/json/JSONFilter.java
@@ -85,7 +85,7 @@ public class JSONFilter {
*/
StringBuilder escaped = null;
int lastUnescapedStart = off;
- for (int i = off; i < length; i++) {
+ for (int i = off; i < off + length; i++) {
char c = input.charAt(i);
if (c < 0x20 || c == 0x22 || c == 0x5c ||
Character.isHighSurrogate(c) || Character.isLowSurrogate(c)) {
if (escaped == null) {
@@ -108,11 +108,11 @@ public class JSONFilter {
if (off == 0 && length == input.length()) {
return input;
} else {
- return input.subSequence(off, length - off);
+ return input.subSequence(off, off + length);
}
} else {
- if (lastUnescapedStart < length) {
- escaped.append(input.subSequence(lastUnescapedStart, length));
+ if (lastUnescapedStart < off + length) {
+ escaped.append(input.subSequence(lastUnescapedStart, off +
length));
}
return escaped.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]