From b5008d33ee20ed03c00feebaafef2ce7e27ef7fa Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 6 Nov 2025 10:41:34 +0100 Subject: [PATCH] Upgrade to ASM 9.9 plus lenient version check patch Closes gh-35763 --- .../java/org/springframework/asm/ClassReader.java | 12 ++++++++---- .../main/java/org/springframework/asm/Opcodes.java | 1 + .../java/org/springframework/asm/SymbolTable.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/asm/ClassReader.java b/spring-core/src/main/java/org/springframework/asm/ClassReader.java index 8ae1e208bb5..5fc6edbe7e8 100644 --- a/spring-core/src/main/java/org/springframework/asm/ClassReader.java +++ b/spring-core/src/main/java/org/springframework/asm/ClassReader.java @@ -193,12 +193,16 @@ public class ClassReader { final byte[] classFileBuffer, final int classFileOffset, final boolean checkClassVersion) { this.classFileBuffer = classFileBuffer; this.b = classFileBuffer; + // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V25) { - throw new IllegalArgumentException( - "Unsupported class file major version " + readShort(classFileOffset + 6)); - } + // SPRING PATCH: leniently try to parse newer class files as well + // if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V26) { + // throw new IllegalArgumentException( + // "Unsupported class file major version " + readShort(classFileOffset + 6)); + // } + // END OF PATCH + // Create the constant pool arrays. The constant_pool_count field is after the magic, // minor_version and major_version fields, which use 4, 2 and 2 bytes respectively. int constantPoolCount = readUnsignedShort(classFileOffset + 8); diff --git a/spring-core/src/main/java/org/springframework/asm/Opcodes.java b/spring-core/src/main/java/org/springframework/asm/Opcodes.java index c912933444d..c2ddd099d81 100644 --- a/spring-core/src/main/java/org/springframework/asm/Opcodes.java +++ b/spring-core/src/main/java/org/springframework/asm/Opcodes.java @@ -290,6 +290,7 @@ public interface Opcodes { int V23 = 0 << 16 | 67; int V24 = 0 << 16 | 68; int V25 = 0 << 16 | 69; + int V26 = 0 << 16 | 70; /** * Version flag indicating that the class is using 'preview' features. diff --git a/spring-core/src/main/java/org/springframework/asm/SymbolTable.java b/spring-core/src/main/java/org/springframework/asm/SymbolTable.java index a4e0cf7f23e..09e3d8e5644 100644 --- a/spring-core/src/main/java/org/springframework/asm/SymbolTable.java +++ b/spring-core/src/main/java/org/springframework/asm/SymbolTable.java @@ -1473,7 +1473,7 @@ final class SymbolTable { /** * Another entry (and so on recursively) having the same hash code (modulo the size of {@link - * SymbolTable#labelEntries}}) as this one. + * SymbolTable#labelEntries}) as this one. */ LabelEntry next;