mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Python: Remove points-to from Expr
This commit is contained in:
@@ -14,20 +14,21 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
import LegacyPointsTo
|
||||
import semmle.python.objects.ObjectInternal
|
||||
import semmle.python.strings
|
||||
|
||||
predicate string_format(BinaryExpr operation, StringLiteral str, Value args, AstNode origin) {
|
||||
operation.getOp() instanceof Mod and
|
||||
exists(Context ctx |
|
||||
operation.getLeft().pointsTo(ctx, _, str) and
|
||||
operation.getRight().pointsTo(ctx, args, origin)
|
||||
operation.getLeft().(ExprWithPointsTo).pointsTo(ctx, _, str) and
|
||||
operation.getRight().(ExprWithPointsTo).pointsTo(ctx, args, origin)
|
||||
)
|
||||
}
|
||||
|
||||
int sequence_length(Value args) {
|
||||
/* Guess length of sequence */
|
||||
exists(Tuple seq | seq.pointsTo(args, _) |
|
||||
exists(Tuple seq | seq.(ExprWithPointsTo).pointsTo(args, _) |
|
||||
result = strictcount(seq.getAnElt()) and
|
||||
not seq.getAnElt() instanceof Starred
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user