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 16:39:12 UTC
[tomcat] 02/02: 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 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 980316f529b9b5d295cfeefc3b502a6a26c9cc4b
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 | 8 ++++----
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/MERGE.txt b/MERGE.txt
index f1e65db66a..17a52c0dc3 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -36,7 +36,7 @@ BCEL
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-03)
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 51145a4432..a2ad52ca2f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -169,10 +169,6 @@
deprecated in Java 20 onwards, the reasons for deprecation are valid for
all versions so move away from them now. (markt)
</scode>
- <update>
- Update the internal fork of Apache Commons BCEL to b015e90 (2022-11-28,
- 6.7.0-RC1). (markt)
- </update>
<update>
Update the internal fork of Apache Commons Codec to ae32a3f (2022-11-29,
1.16-SNAPSHOT). (markt)
@@ -188,6 +184,10 @@
Update the internal fork of Apache Commons FileUpload to 34eb241
(2023-01-03, 2.0-SNAPSHOT). (markt)
</update>
+ <update>
+ Update the internal fork of Apache Commons BCEL to 2ee2bff (2023-01-03,
+ 6.7.1-SNAPSHOT). (markt)
+ </update>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org