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 b20ff92c10 Fix equals on a null MB
b20ff92c10 is described below
commit b20ff92c101f5d49430a8af8e2ca6d8c84d7b3f9
Author: remm <[email protected]>
AuthorDate: Wed May 20 12:51:42 2026 +0200
Fix equals on a null MB
Handle special arithmetic case of Long.MIN_VALUE.
---
java/org/apache/tomcat/util/buf/MessageBytes.java | 9 ++++++---
webapps/docs/changelog.xml | 3 +++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/tomcat/util/buf/MessageBytes.java
b/java/org/apache/tomcat/util/buf/MessageBytes.java
index 06bfb60111..5bc5be6b7a 100644
--- a/java/org/apache/tomcat/util/buf/MessageBytes.java
+++ b/java/org/apache/tomcat/util/buf/MessageBytes.java
@@ -457,8 +457,7 @@ public final class MessageBytes implements Cloneable,
Serializable {
if (mb.type == T_BYTES && type == T_CHARS) {
return mb.byteC.equals(charC);
}
- // can't happen
- return true;
+ return (mb.type == T_NULL && type == T_NULL);
}
@@ -616,7 +615,11 @@ public final class MessageBytes implements Cloneable,
Serializable {
buf[end++] = (byte) '0';
}
if (l < 0) {
- current = -l;
+ if (l == Long.MIN_VALUE) {
+ current = Long.MAX_VALUE;
+ } else {
+ current = -l;
+ }
buf[end++] = (byte) '-';
}
while (current > 0) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index af9c428c0c..adcc299a73 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,9 @@
Properly use <code>pollerThreadPriority</code> for the NIO poller
thread. (remm)
</fix>
+ <fix>
+ Fix <code>MessageByte.equals</code> if called on a null MB. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]