mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Merge pull request #16804 from github/tausbn/python-fix-bad-join-in-dataflow-dispatch
Python: Fix bad join in `DataFlowDispatch`
This commit is contained in:
@@ -829,10 +829,16 @@ Function findFunctionAccordingToMro(Class cls, string name) {
|
||||
result = cls.getAMethod() and
|
||||
result.getName() = name
|
||||
or
|
||||
not cls.getAMethod().getName() = name and
|
||||
not class_has_method(cls, name) and
|
||||
result = findFunctionAccordingToMro(getNextClassInMro(cls), name)
|
||||
}
|
||||
|
||||
/**
|
||||
* Join-order helper for `findFunctionAccordingToMro` and `findFunctionAccordingToMroKnownStartingClass`.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
private predicate class_has_method(Class cls, string name) { cls.getAMethod().getName() = name }
|
||||
|
||||
/**
|
||||
* Gets a class that, from an approximated MRO calculation, might be the next class
|
||||
* after `cls` in the MRO for `startingClass`.
|
||||
@@ -860,7 +866,7 @@ private Function findFunctionAccordingToMroKnownStartingClass(
|
||||
result.getName() = name and
|
||||
cls = getADirectSuperclass*(startingClass)
|
||||
or
|
||||
not cls.getAMethod().getName() = name and
|
||||
not class_has_method(cls, name) and
|
||||
result =
|
||||
findFunctionAccordingToMroKnownStartingClass(getNextClassInMroKnownStartingClass(cls,
|
||||
startingClass), startingClass, name)
|
||||
|
||||
Reference in New Issue
Block a user