You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/03 12:53:32 UTC
[tomcat] 02/03: Update package renamed fork of Commons BCEL
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a6fed7ace3ac90919f598a6eb2bfa4d95e54f61f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jan 3 12:28:02 2023 +0000
Update package renamed fork of Commons BCEL
---
MERGE.txt | 2 +-
.../tomcat/util/bcel/classfile/ConstantPool.java | 18 +++++++++++-------
webapps/docs/changelog.xml | 4 ++++
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/MERGE.txt b/MERGE.txt
index 41646180c2..de8e38d901 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -37,7 +37,7 @@ Unused code is removed
Sub-tree:
src/main/java/org/apache/bcel
The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
-b015e90257850e810e57d1244664300f50de4a4c (2022-11-28)
+2ee2bff580c7138545377628074173412c27290c (2023-01-02)
Codec
-----
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java b/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
index 468314f097..a9639e0be4 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
@@ -44,6 +44,7 @@ public class ConstantPool {
constantPool = new Constant[constantPoolCount];
/*
* constantPool[0] is unused by the compiler and may be used freely by the implementation.
+ * constantPool[0] is currently unused by the implementation.
*/
for (int i = 1; i < constantPoolCount; i++) {
constantPool[i] = Constant.readConstant(input);
@@ -105,22 +106,25 @@ public class ConstantPool {
* @throws ClassFormatException if index is invalid
*/
public <T extends Constant> T getConstant(final int index, final Class<T> castTo) throws ClassFormatException {
- if (index >= constantPool.length || index < 0) {
+ if (index >= constantPool.length || index < 1) {
throw new ClassFormatException("Invalid constant pool reference using index: " + index + ". Constant pool size is: " + constantPool.length);
}
if (constantPool[index] != null && !castTo.isAssignableFrom(constantPool[index].getClass())) {
throw new ClassFormatException("Invalid constant pool reference at index: " + index +
". Expected " + castTo + " but was " + constantPool[index].getClass());
}
- // Previous check ensures this won't throw a ClassCastException
- final T c = castTo.cast(constantPool[index]);
- // the 0th element is always null
- if (c == null && index != 0) {
+ if (index > 1) {
final Constant prev = constantPool[index - 1];
- if (prev == null || prev.getTag() != Const.CONSTANT_Double && prev.getTag() != Const.CONSTANT_Long) {
- throw new ClassFormatException("Constant pool at index " + index + " is null.");
+ if (prev != null && (prev.getTag() == Const.CONSTANT_Double || prev.getTag() == Const.CONSTANT_Long)) {
+ throw new ClassFormatException("Constant pool at index " + index + " is invalid. The index is unused due to the preceeding "
+ + Const.getConstantName(prev.getTag()) + ".");
}
}
+ // Previous check ensures this won't throw a ClassCastException
+ final T c = castTo.cast(constantPool[index]);
+ if (c == null) {
+ throw new ClassFormatException("Constant pool at index " + index + " is null.");
+ }
return c;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 43facab6e9..bed020552d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -163,6 +163,10 @@
Update the packaged version of the Apache Tomcat Migration Tool for
Jakarta EE to 1.0.6. (markt)
</update>
+ <update>
+ Update the internal fork of Apache Commons BCEL to 2ee2bff (2023-01-02,
+ 6.7.1-SNAPSHOT). (markt)
+ </update>
<update>
Update the internal fork of Apache Commons FileUpload to 34eb241
(2023-01-03, 2.0-SNAPSHOT). (markt)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org