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 edb01f4e26 Fix equals on a null MB
edb01f4e26 is described below
commit edb01f4e262f56ba1e599f17d55fd8892c3b0158
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 d6454cb5df..16fc43cc9e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -295,6 +295,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]