From 274919ca0893e7b6500690c457b77369e7a0fb59 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Wed, 5 Feb 2020 15:15:15 +0100 Subject: [PATCH 1/2] Java: Fix recent perf regressions. --- java/ql/src/semmle/code/java/Expr.qll | 1 + .../semmle/code/java/dataflow/internal/DataFlowImpl.qll | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/java/ql/src/semmle/code/java/Expr.qll b/java/ql/src/semmle/code/java/Expr.qll index 08f869c01f2..afed3bafd0e 100755 --- a/java/ql/src/semmle/code/java/Expr.qll +++ b/java/ql/src/semmle/code/java/Expr.qll @@ -167,6 +167,7 @@ class CompileTimeConstantExpr extends Expr { /** * Gets the string value of this expression, where possible. */ + pragma[nomagic] string getStringValue() { result = this.(StringLiteral).getRepresentedString() or diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll index 8bc46a0825b..f99373782fa 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } From 07482abed71016c1604e07c6ccdd2aa9d046bc71 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Wed, 5 Feb 2020 15:17:20 +0100 Subject: [PATCH 2/2] Java/C++/C#: Sync. --- .../semmle/code/cpp/dataflow/internal/DataFlowImpl.qll | 8 ++++---- .../semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll | 8 ++++---- .../semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll | 8 ++++---- .../semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll | 8 ++++---- .../code/cpp/dataflow/internal/DataFlowImplLocal.qll | 8 ++++---- .../semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll | 8 ++++---- .../code/cpp/ir/dataflow/internal/DataFlowImpl2.qll | 8 ++++---- .../code/cpp/ir/dataflow/internal/DataFlowImpl3.qll | 8 ++++---- .../code/cpp/ir/dataflow/internal/DataFlowImpl4.qll | 8 ++++---- .../semmle/code/csharp/dataflow/internal/DataFlowImpl.qll | 8 ++++---- .../code/csharp/dataflow/internal/DataFlowImpl2.qll | 8 ++++---- .../code/csharp/dataflow/internal/DataFlowImpl3.qll | 8 ++++---- .../code/csharp/dataflow/internal/DataFlowImpl4.qll | 8 ++++---- .../code/csharp/dataflow/internal/DataFlowImpl5.qll | 8 ++++---- .../semmle/code/java/dataflow/internal/DataFlowImpl2.qll | 8 ++++---- .../semmle/code/java/dataflow/internal/DataFlowImpl3.qll | 8 ++++---- .../semmle/code/java/dataflow/internal/DataFlowImpl4.qll | 8 ++++---- .../semmle/code/java/dataflow/internal/DataFlowImpl5.qll | 8 ++++---- 18 files changed, 72 insertions(+), 72 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll index 8bc46a0825b..f99373782fa 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll index 8bc46a0825b..f99373782fa 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll index 8bc46a0825b..f99373782fa 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll index 8bc46a0825b..f99373782fa 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll index 8bc46a0825b..f99373782fa 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll index 8bc46a0825b..f99373782fa 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll index 8bc46a0825b..f99373782fa 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll index 8bc46a0825b..f99373782fa 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll index 8bc46a0825b..f99373782fa 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) } diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll index 8bc46a0825b..f99373782fa 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll @@ -2041,12 +2041,12 @@ private class PathNodeMid extends PathNode, TPathNodeMid { result = getSuccMid() or // a final step to a sink via zero steps means we merge the last two steps to prevent trivial-looking edges - exists(PathNodeMid mid | + exists(PathNodeMid mid, PathNodeSink sink | mid = getSuccMid() and - mid.getNode() = result.getNode() and + mid.getNode() = sink.getNode() and mid.getAp() instanceof AccessPathNil and - result instanceof PathNodeSink and - result.getConfiguration() = unbind(mid.getConfiguration()) + sink.getConfiguration() = unbind(mid.getConfiguration()) and + result = sink ) }