You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Potential NPE from MethodParameter.getMethod() check in KotlinDelegate.hasDefaultValue() #33609
), the return value of the getMethod method was checked for null value. But if we put it directly inside Objects.requireNonNull, we may have an exception.
A potential fix will be to replace the following line
Methodmethod = parameter.getMethod();
if (method == null) {
returnfalse;
}
Another option could be to use Objects.requireNonNullElse.
Sponsorship and Support
This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed – to improve global software supply chain security.
The bug is found by running the Intelligent Code Repair (iCR) tool by OpenRefactory and then manually triaging the results.
Good catch, this is worth turning into a more defensive check within that local delegate (also in the equivalent code in AbstractNamedValueMethodArgumentResolver for Spring MVC). That said, in practice it is not an actual bug since all current invocation scenarios are method-based anyway.
changed the title [-]Potential null pointer dereference where a null check should be added[/-][+]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue`[/+]on Sep 30, 2024
changed the title [-]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue`[/-][+]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue()`[/+]on Sep 30, 2024
Activity
jhoeller commentedon Sep 30, 2024
Good catch, this is worth turning into a more defensive check within that local delegate (also in the equivalent code in
AbstractNamedValueMethodArgumentResolverfor Spring MVC). That said, in practice it is not an actual bug since all current invocation scenarios are method-based anyway.[-]Potential null pointer dereference where a null check should be added[/-][+]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue`[/+][-]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue`[/-][+]Potential NPE from `MethodParameter.getMethod()` check in `KotlinDelegate.hasDefaultValue()`[/+]Defensively check MethodParameter.getMethod() in KotlinDelegate