This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new a7761952cb Fix unused end <-> length confusion
a7761952cb is described below
commit a7761952cbd0ef16c8d1a545c7e1264ed8af9493
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 1e3735a648..8b0416962b 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]