This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 740e88d78e1a31dac9e9c92a4f12b743e0a2a19e 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 223868bc5c..103e396411 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 b44c13668d..0f3ff2285b 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -140,6 +140,10 @@ </subsection> <subsection name="Other"> <changelog> + <update> + Update the internal fork of Apache Commons BCEL to 2ee2bff (2023-01-03, + 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org