Skip to content

Commit cf2c1bf

Browse files
authored
Merge pull request #19 from tomitribe/v.6.1.21.RELEASE-TT.x-cve41249
backport from 6.2.x (commit 0e3e34b) to fix CVE-2025-41249
2 parents 27c3f7e + ee5117a commit cf2c1bf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotatedMethod.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.lang.annotation.Annotation;
2020
import java.lang.reflect.Method;
21+
import java.lang.reflect.Modifier;
2122
import java.util.ArrayList;
2223
import java.util.Arrays;
2324
import java.util.List;
@@ -38,6 +39,7 @@
3839
* interface-declared parameter annotations from the concrete target method.
3940
*
4041
* @author Juergen Hoeller
42+
* @author Sam Brannen
4143
* @since 6.1
4244
* @see #getMethodAnnotation(Class)
4345
* @see #getMethodParameters()
@@ -181,7 +183,7 @@ private List<Annotation[][]> getInheritedParameterAnnotations() {
181183
clazz = null;
182184
}
183185
if (clazz != null) {
184-
for (Method candidate : clazz.getMethods()) {
186+
for (Method candidate : clazz.getDeclaredMethods()) {
185187
if (isOverrideFor(candidate)) {
186188
parameterAnnotations.add(candidate.getParameterAnnotations());
187189
}
@@ -194,8 +196,9 @@ private List<Annotation[][]> getInheritedParameterAnnotations() {
194196
}
195197

196198
private boolean isOverrideFor(Method candidate) {
197-
if (!candidate.getName().equals(this.method.getName()) ||
198-
candidate.getParameterCount() != this.method.getParameterCount()) {
199+
if (Modifier.isPrivate(candidate.getModifiers()) ||
200+
!candidate.getName().equals(this.method.getName()) ||
201+
(candidate.getParameterCount() != this.method.getParameterCount())) {
199202
return false;
200203
}
201204
Class<?>[] paramTypes = this.method.getParameterTypes();

0 commit comments

Comments
 (0)