python: RaisingTuple.ql to not use poins-to

Use local dataflow instead and simply check for tuple literals.
This commit is contained in:
Rasmus Lerchedahl Petersen
2022-09-01 21:45:57 +02:00
parent 2223bc3d1f
commit 93fcaf24c1

View File

@@ -10,11 +10,14 @@
*/
import python
import semmle.python.dataflow.new.DataFlow
from Raise r, Value v, AstNode origin
from Raise r, DataFlow::LocalSourceNode origin
where
r.getException().pointsTo(v, origin) and
v.getClass() = ClassValue::tuple() and
exists(DataFlow::Node exception | exception.asExpr() = r.getException() |
origin.flowsTo(exception)
) and
origin.asExpr() instanceof Tuple and
major_version() = 2
/* Raising a tuple is a type error in Python 3, so is handled by the IllegalRaise query. */
select r,