-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17521 from michaelnebel/modelgen/moreimprovements
C#/Java: Content based model generation improvements.
- Loading branch information
Showing
40 changed files
with
626 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
csharp/ql/src/utils/modelgenerator/CaptureMixedNeutralModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @name Capture mixed neutral models. | ||
* @description Finds neutral models to be used by other queries. | ||
* @kind diagnostic | ||
* @id cs/utils/modelgenerator/mixed-neutral-models | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import internal.CaptureModels | ||
|
||
from DataFlowSummaryTargetApi api, string noflow | ||
where noflow = captureMixedNeutral(api) | ||
select noflow order by noflow |
13 changes: 13 additions & 0 deletions
13
csharp/ql/src/utils/modelgenerator/CaptureMixedSummaryModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @name Capture mixed summary models. | ||
* @description Finds applicable summary models to be used by other queries. | ||
* @kind diagnostic | ||
* @id cs/utils/modelgenerator/mixed-summary-models | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import internal.CaptureModels | ||
|
||
from DataFlowSummaryTargetApi api, string flow | ||
where flow = captureMixedFlow(api, _) | ||
select flow order by flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+512 Bytes
(110%)
csharp/ql/test/library-tests/dataflow/external-models/ExternalFlow.dll
Binary file not shown.
86 changes: 50 additions & 36 deletions
86
csharp/ql/test/library-tests/dataflow/external-models/ExternalFlow.expected
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
251 changes: 187 additions & 64 deletions
251
csharp/ql/test/utils/modelgenerator/dataflow/Summaries.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
java/ql/src/utils/modelgenerator/CaptureMixedNeutralModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @name Capture mixed neutral models. | ||
* @description Finds neutral models to be used by other queries. | ||
* @kind diagnostic | ||
* @id java/utils/modelgenerator/mixed-neutral-models | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import internal.CaptureModels | ||
|
||
from DataFlowSummaryTargetApi api, string noflow | ||
where noflow = captureMixedNeutral(api) | ||
select noflow order by noflow |
13 changes: 13 additions & 0 deletions
13
java/ql/src/utils/modelgenerator/CaptureMixedSummaryModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @name Capture mixed summary models. | ||
* @description Finds applicable summary models to be used by other queries. | ||
* @kind diagnostic | ||
* @id java/utils/modelgenerator/mixed-summary-models | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import internal.CaptureModels | ||
|
||
from DataFlowSummaryTargetApi api, string flow | ||
where flow = captureMixedFlow(api, _) | ||
select flow order by flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package p; | ||
|
||
public class Fanout { | ||
public interface I1 { | ||
String getValue(); | ||
} | ||
|
||
public interface I2 extends I1 {} | ||
|
||
public class Impl1 implements I1 { | ||
public String v; | ||
|
||
// summary=p;Fanout$I1;true;getValue;();;Argument[this];ReturnValue;taint;df-generated | ||
// contentbased-summary=p;Fanout$Impl1;true;getValue;();;Argument[this].Field[p.Fanout$Impl1.v];ReturnValue;value;dfc-generated | ||
public String getValue() { | ||
return v; | ||
} | ||
} | ||
|
||
public class Impl2 implements I2 { | ||
public String v; | ||
|
||
// summary=p;Fanout$I1;true;getValue;();;Argument[this];ReturnValue;taint;df-generated | ||
// contentbased-summary=p;Fanout$Impl2;true;getValue;();;Argument[this].Field[p.Fanout$Impl2.v];ReturnValue;value;dfc-generated | ||
public String getValue() { | ||
return v; | ||
} | ||
} | ||
|
||
public class Impl3 implements I2 { | ||
public String v; | ||
|
||
// summary=p;Fanout$I1;true;getValue;();;Argument[this];ReturnValue;taint;df-generated | ||
// contentbased-summary=p;Fanout$Impl3;true;getValue;();;Argument[this].Field[p.Fanout$Impl3.v];ReturnValue;value;dfc-generated | ||
public String getValue() { | ||
return v; | ||
} | ||
} | ||
|
||
public class Impl4 implements I2 { | ||
public String v; | ||
|
||
// summary=p;Fanout$I1;true;getValue;();;Argument[this];ReturnValue;taint;df-generated | ||
// contentbased-summary=p;Fanout$Impl4;true;getValue;();;Argument[this].Field[p.Fanout$Impl4.v];ReturnValue;value;dfc-generated | ||
public String getValue() { | ||
return v; | ||
} | ||
} | ||
|
||
// summary=p;Fanout;true;concatGetValueOnI1;(String,Fanout$I1);;Argument[0];ReturnValue;taint;df-generated | ||
// summary=p;Fanout;true;concatGetValueOnI1;(String,Fanout$I1);;Argument[1];ReturnValue;taint;df-generated | ||
// No content based summaries are expected for this method on parameter `i` | ||
// as the fanout (number of content flows) exceeds the limit of 3. | ||
// contentbased-summary=p;Fanout;true;concatGetValueOnI1;(String,Fanout$I1);;Argument[0];ReturnValue;taint;dfc-generated | ||
public String concatGetValueOnI1(String other, I1 i) { | ||
return other + i.getValue(); | ||
} | ||
|
||
// summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[0];ReturnValue;taint;df-generated | ||
// summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[1];ReturnValue;taint;df-generated | ||
// contentbased-summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[0];ReturnValue;taint;dfc-generated | ||
// contentbased-summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[1].Field[p.Fanout$Impl2.v];ReturnValue;taint;dfc-generated | ||
// contentbased-summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[1].Field[p.Fanout$Impl3.v];ReturnValue;taint;dfc-generated | ||
// contentbased-summary=p;Fanout;true;concatGetValueOnI2;(String,Fanout$I2);;Argument[1].Field[p.Fanout$Impl4.v];ReturnValue;taint;dfc-generated | ||
public String concatGetValueOnI2(String other, I2 i) { | ||
return other + i.getValue(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.