Skip to content

Commit 098afb9

Browse files
committed
Address more review comments
1 parent a46964d commit 098afb9

File tree

6 files changed

+22
-40
lines changed

6 files changed

+22
-40
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ private predicate interpretSummary(
516516
)
517517
}
518518

519+
// adapter class for converting Mad summaries to `SummarizedCallable`s
519520
private class SummarizedCallableAdapter extends SummarizedCallable {
520521
SummarizedCallableAdapter() { interpretSummary(this, _, _, _, _) }
521522

@@ -549,6 +550,7 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
549550
}
550551
}
551552

553+
// adapter class for converting Mad neutrals to `NeutralCallable`s
552554
private class NeutralCallableAdapter extends NeutralCallable {
553555
string kind;
554556
string provenance_;

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ private predicate interpretSummary(
384384
)
385385
}
386386

387+
// adapter class for converting Mad summaries to `SummarizedCallable`s
387388
private class SummarizedCallableAdapter extends SummarizedCallable {
388389
SummarizedCallableAdapter() { interpretSummary(this, _, _, _, _) }
389390

@@ -417,6 +418,7 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
417418
}
418419
}
419420

421+
// adapter class for converting Mad neutrals to `NeutralCallable`s
420422
private class NeutralCallableAdapter extends NeutralCallable {
421423
string kind;
422424
string provenance_;

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ private module Cached {
513513

514514
import Cached
515515

516+
// adapter class for converting Mad summaries to `SummarizedCallable`s
516517
private class SummarizedCallableAdapter extends SummarizedCallable {
517518
SummarizedCallableAdapter() { summaryElement(this, _, _, _, _) }
518519

@@ -546,6 +547,7 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
546547
}
547548
}
548549

550+
// adapter class for converting Mad neutrals to `NeutralCallable`s
549551
private class NeutralCallableAdapter extends NeutralCallable {
550552
string kind;
551553
string provenance_;

shared/dataflow/codeql/dataflow/internal/AccessPathSyntax.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bindingset[arg]
3737
int parseLowerBound(string arg) { result = arg.regexpCapture("(-?\\d+)\\.\\.", 1).toInt() }
3838

3939
/**
40-
* An access part token such as `Argument[1]` or `ReturnValue`.
40+
* An access path token such as `Argument[1]` or `ReturnValue`.
4141
*/
4242
class AccessPathTokenBase extends string {
4343
bindingset[this]
@@ -181,7 +181,7 @@ module AccessPath<accessPathRangeSig/1 accessPathRange> {
181181
}
182182

183183
/**
184-
* An access part token such as `Argument[1]` or `ReturnValue`, appearing in one or more access paths.
184+
* An access path token such as `Argument[1]` or `ReturnValue`, appearing in one or more access paths.
185185
*/
186186
class AccessPathToken extends AccessPathTokenBaseFinal {
187187
AccessPathToken() { this = getRawToken(_, _) }

shared/dataflow/codeql/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,12 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
394394
}
395395
}
396396

397-
private predicate summaryElement(
398-
SummarizedCallable c, string input, string output, boolean preservesValue, string provenance
399-
) {
400-
c.propagatesFlow(input, output, preservesValue) and
401-
c.hasProvenance(provenance)
402-
}
403-
404397
private predicate summarySpec(string spec) {
405-
summaryElement(_, spec, _, _, _) or
406-
summaryElement(_, _, spec, _, _)
398+
exists(SummarizedCallable c |
399+
c.propagatesFlow(spec, _, _)
400+
or
401+
c.propagatesFlow(_, spec, _)
402+
)
407403
}
408404

409405
import AccessPathSyntax::AccessPath<summarySpec/1>
@@ -652,7 +648,7 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
652648

653649
/**
654650
* Holds if `c` has a flow summary from `input` to `arg`, where `arg`
655-
* writes to (contents of) arguments at position `pos`, and `c` has a
651+
* writes to (contents of) arguments at (some) position `pos`, and `c` has a
656652
* value-preserving flow summary from the arguments at position `pos`
657653
* to a return value (`return`).
658654
*
@@ -1423,43 +1419,21 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
14231419
}
14241420
}
14251421

1426-
private class SummarizedCallableExternal extends SummarizedCallableImpl instanceof SummarizedCallable
1422+
// adapter class for converting `SummarizedCallable`s to `SummarizedCallableImpl`s
1423+
private class SummarizedCallableImplAdapter extends SummarizedCallableImpl instanceof SummarizedCallable
14271424
{
1428-
SummarizedCallableExternal() { summaryElement(this, _, _, _, _) }
1429-
1430-
private predicate relevantSummaryElementGenerated(
1431-
AccessPath inSpec, AccessPath outSpec, boolean preservesValue
1432-
) {
1433-
exists(Provenance provenance |
1434-
provenance.isGenerated() and
1435-
summaryElement(this, inSpec, outSpec, preservesValue, provenance)
1436-
) and
1437-
not super.applyManualModel()
1438-
}
1439-
1440-
private predicate relevantSummaryElement(
1441-
AccessPath inSpec, AccessPath outSpec, boolean preservesValue
1442-
) {
1443-
exists(Provenance provenance |
1444-
provenance.isManual() and
1445-
summaryElement(this, inSpec, outSpec, preservesValue, provenance)
1446-
)
1447-
or
1448-
this.relevantSummaryElementGenerated(inSpec, outSpec, preservesValue)
1449-
}
1450-
14511425
override predicate propagatesFlow(
14521426
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
14531427
) {
14541428
exists(AccessPath inSpec, AccessPath outSpec |
1455-
this.relevantSummaryElement(inSpec, outSpec, preservesValue) and
1429+
SummarizedCallable.super.propagatesFlow(inSpec, outSpec, preservesValue) and
14561430
interpretSpec(inSpec, input) and
14571431
interpretSpec(outSpec, output)
14581432
)
14591433
}
14601434

14611435
override predicate hasProvenance(Provenance provenance) {
1462-
summaryElement(this, _, _, _, provenance)
1436+
SummarizedCallable.super.hasProvenance(provenance)
14631437
}
14641438
}
14651439

@@ -1492,13 +1466,13 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
14921466

14931467
/**
14941468
* Holds if an external source specification exists for `n` with output specification
1495-
* `output`, kind `kind`, and provenance `provenance`.
1469+
* `output` and kind `kind`.
14961470
*/
14971471
predicate sourceElement(Element n, string output, string kind);
14981472

14991473
/**
15001474
* Holds if an external sink specification exists for `n` with input specification
1501-
* `input`, kind `kind` and provenance `provenance`.
1475+
* `input` and kind `kind`.
15021476
*/
15031477
predicate sinkElement(Element n, string input, string kind);
15041478

swift/ql/lib/codeql/swift/dataflow/ExternalFlow.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ private predicate interpretSummary(
527527
)
528528
}
529529

530+
// adapter class for converting Mad summaries to `SummarizedCallable`s
530531
private class SummarizedCallableAdapter extends SummarizedCallable {
531532
SummarizedCallableAdapter() { interpretSummary(this, _, _, _, _) }
532533

@@ -560,6 +561,7 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
560561
}
561562
}
562563

564+
// adapter class for converting Mad neutrals to `NeutralCallable`s
563565
private class NeutralCallableAdapter extends NeutralCallable {
564566
string kind;
565567
string provenance_;

0 commit comments

Comments
 (0)