Skip to content

Commit 81c35c8

Browse files
committed
Adjust PathSanitizer to use fixed $default extension method functionality
1 parent f646938 commit 81c35c8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

java/ql/lib/semmle/code/java/security/PathSanitizer.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ private class PathNormalizeSanitizer extends MethodAccess {
298298
* what `getQualifier` actually gets in Java and Kotlin.
299299
*/
300300
private Expr getVisualQualifier(MethodAccess ma) {
301-
if getSourceMethod(ma.getMethod()) instanceof ExtensionMethod
302-
then result = ma.getArgument(0)
301+
if ma.getMethod() instanceof ExtensionMethod
302+
then result = ma.getArgument(ma.getMethod().(ExtensionMethod).getExtensionParameterIndex())
303303
else result = ma.getQualifier()
304304
}
305305

@@ -310,8 +310,10 @@ private Expr getVisualQualifier(MethodAccess ma) {
310310
*/
311311
bindingset[argPos]
312312
private Argument getVisualArgument(MethodAccess ma, int argPos) {
313-
if getSourceMethod(ma.getMethod()) instanceof ExtensionMethod
314-
then result = ma.getArgument(argPos + 1)
313+
if ma.getMethod() instanceof ExtensionMethod
314+
then
315+
result =
316+
ma.getArgument(argPos + ma.getMethod().(ExtensionMethod).getExtensionParameterIndex() + 1)
315317
else result = ma.getArgument(argPos)
316318
}
317319

0 commit comments

Comments
 (0)