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