Commit Graph

877 Commits

Author SHA1 Message Date
Tom Hvitved
65b4d35add Merge pull request #4055 from tamasvajk/feature/partial-methods
C#: Add body to partial methods
2020-08-20 10:14:56 +02:00
Tamas Vajk
0cf4c99986 C#: Change compiler generated flag for length arguments of implicitly sized arrays 2020-08-18 12:06:01 +02:00
Tamas Vajk
99e62ceee6 C#: Add test for length argument of implicitly sized arrays 2020-08-18 11:44:24 +02:00
Tamas Vajk
beeadea48f Add extra tests for partial methods 2020-08-18 10:26:31 +02:00
Tom Hvitved
c20d763490 Merge pull request #3951 from raulgarciamsft/users/raulgarciamsft/dataset_serialization
C#: DataSet serialization
2020-08-07 12:54:10 +02:00
Raul Garcia (MSFT)
64f4613a3f Removing the options file as requested 2020-07-30 10:25:15 -07:00
Raul Garcia (MSFT)
9e74c183fe Fixing expected results after adding comments to the unit test .cs file 2020-07-30 10:24:24 -07:00
Tom Hvitved
05307b8757 C#: Remove more FPs in cs/dereferenced-value-may-be-null 2020-07-30 12:16:59 +02:00
Tom Hvitved
4f4d9d35be C#: Add more nullness tests 2020-07-30 12:15:49 +02:00
Raul Garcia (MSFT)
7923c480af Fixing queries based on suggestions/comments.
TODO: Auto-formatting is still pending (need guidance on how to enable it on my environment). Thanks
2020-07-29 17:14:37 -07:00
Tom Hvitved
d39a33655f C#: Fix false-positives in cs/dereferenced-value-may-be-null
Dereferencing an expression of a nullable type should only be reported when
the expression is not clearly non-null.
2020-07-28 16:27:36 +02:00
Tom Hvitved
ce2368de96 C#: Add tests for null-coalescing assignment 2020-07-28 11:07:47 +02:00
Raul Garcia (MSFT)
5387294168 Moving to experimental as requested 2020-07-16 09:32:17 -07:00
Raul Garcia (MSFT)
3e0481b889 Queries to help on the detection based on misuse of DataSet and DataTable serialization that could lead to security problems.
https://go.microsoft.com/fwlink/?linkid=2132227
2020-07-14 17:54:54 -07:00
Calum Grant
dcff87fb2e Merge pull request #3366 from hvitved/csharp/dataflow/arrays
C#: Precise data-flow for collections
2020-07-14 17:12:29 +01:00
Tom Hvitved
527a099a26 C#: Fix CFG for conditional method calls with out parameters 2020-07-02 13:12:53 +02:00
Tom Hvitved
090205d9e9 C#: Add CFG test for conditional call to method with out parameter 2020-07-02 13:09:40 +02:00
Tom Hvitved
795c5784b0 C#: Precise data flow for collections 2020-06-26 13:40:05 +02:00
Tom Hvitved
6efbd5f9d1 C#: Add data-flow test for List.Clear() 2020-06-26 11:44:08 +02:00
Calum Grant
8725e09053 Merge pull request #3798 from hvitved/csharp/dataflow/async-tests
C#: Move async data-flow tests from local to global
2020-06-26 10:14:28 +01:00
Tom Hvitved
b8ae4b7f64 C#: Move async data-flow tests from local to global 2020-06-25 10:04:18 +02:00
Tom Hvitved
3f91aa3b55 C#: More data-flow collection tests 2020-06-25 09:48:52 +02:00
Tom Hvitved
3faca03de6 C#: Introduce ObjectInitializerNode 2020-06-23 10:55:12 +02:00
Tom Hvitved
a1d5591634 C#: Model field-clearing in data-flow 2020-06-23 10:55:11 +02:00
Tom Hvitved
b5bc15a097 C#: Add more field-flow tests 2020-06-23 10:55:11 +02:00
Calum Grant
f2f020fa51 Merge pull request #3610 from hvitved/csharp/dataflow/call-sensitivity
C#: Add call-sensitivity to data-flow call resolution
2020-06-22 10:36:45 +01:00
Anders Schack-Mulligen
8107fbadc2 Merge pull request #3456 from hvitved/dataflow/precise-field-types
Data flow: Track precise types during field flow
2020-06-19 11:50:10 +02:00
Tom Hvitved
ca86bb8603 Address review comments 2020-06-19 10:34:11 +02:00
Dave Bartolomeo
881b3c8e33 C#: Fix IR consistency errors
We were creating a `TranslatedFunction` even for functions that were not from source code, but then telling the IR package that those functions didn't have IR. This resulted in having prologue/epilogue instructions (e.g. `EnterFunction`, `ExitFunction`) with no enclosing `IRFunction`.
2020-06-15 11:33:00 -04:00
Dave Bartolomeo
8cbc7e8654 C++/C#: Improve consistency failure result messages
Some of our IR consistency failure query predicates already produced results in the schema as an `@kind problem` query, including `$@` replacements for the enclosing `IRFunction` to make it easier to figure out which function to dump when debugging. This change moves the rest of the query predicates in `IRConsistency.qll` to do the same. In addition, it wraps each call to `getEnclosingIRFunction()` to return an `OptionalIRFunction`, which can be either a real `IRFunction` or a placeholder in case `getEnclosingIRFunction()` returned no results. This exposes a couple new consistency failures in `syntax-zoo`, which will be fixed in a subsequent commit.

This change also deals with consistency failures when the enclosing `IRFunction` has more than one `Function` or `Location`. For multiple `Function`s, we concatenate the function names. For multiple `Location`s, we pick the first one in lexicographical order. This changes the number of results produced in the existing tests, but does't change the actual number of problems.
2020-06-15 10:46:46 -04:00
Calum Grant
cd914deeff Merge pull request #3666 from hvitved/csharp/ir-experimental
C#: Move IR code into 'experimental' folder
2020-06-10 19:50:37 +01:00
Tom Hvitved
70c3ff36f8 C#: Adjust IR imports 2020-06-10 09:54:56 +02:00
Tom Hvitved
3c8735f43f C#: Move IR code into 'experimental' folder 2020-06-10 09:37:30 +02:00
Tom Hvitved
8c9f85d04f Data flow: Allow nodes to be hidden from path explanations 2020-06-09 13:53:19 +02:00
Tom Hvitved
9e7ca25732 C#: Add call-sensitivity to data-flow call resolution 2020-06-03 20:43:49 +02:00
Tom Hvitved
86dd86848f C#: Update call-sensitivity data-flow tests 2020-06-03 14:21:23 +02:00
Dave Bartolomeo
476f27e427 Merge from master 2020-05-28 17:27:08 -04:00
Calum Grant
2b90b50587 Merge pull request #3528 from hvitved/csharp/cfg/cs6-initializers
C#: Fix CFG for C# 6 initializers
2020-05-28 21:40:52 +01:00
Dave Bartolomeo
533eeff7e8 C++: Fix MemoryLocation with multiple VirtualVariables
While investigating a bug with `TInstruction` sharing, I discovered that we had a case where alias analysis could create two `VirtualVariable`s for the same `Allocation`. For an indirect parameter allocation, we were using the type of the pointer variable as the type of the indirect allocation, instead of just `Unknown`. If the `IRType` of the pointer variable was the same type as the type of at least one access to the indirect allocation, we'd create both an `EntireAllocationVirtualVariable` and a `VariableVirtualVariable` for the allocation.

I added a new consistency test to guard against this in the future. This also turned out to be the root cause of the one existing known consistency failure in the IR tests.
2020-05-27 14:06:59 -04:00
Tom Hvitved
011a95dcfa C#: Fix extracted type for nested object initializers 2020-05-20 14:20:41 +02:00
Tom Hvitved
70d47b76b1 C#: Add test for the type of an object initializer 2020-05-20 14:18:16 +02:00
Tom Hvitved
7a54a90e61 C#: Fix CFG for C# 6 initializers 2020-05-20 12:01:22 +02:00
Tom Hvitved
36e29e0f75 C#: Add CFG tests for C# 6 initializers 2020-05-20 09:33:51 +02:00
Tom Hvitved
e9839198f4 Merge pull request #3484 from calumgrant/cs/index-initializers
C#: Extract indexed initializers correctly
2020-05-20 09:22:47 +02:00
Dave Bartolomeo
42c659b8f2 C++/C#: Remove UnmodeledDefinition instruction 2020-05-18 15:08:50 -04:00
Dave Bartolomeo
35868d4e5b C++/C#: Change dump of unmodeled use to m?
This is kind of inconsequential on its own, but will make the test diffs easier to understand once the next commit removes `UnmodeledDefinition`.
2020-05-18 10:47:43 -04:00
Calum Grant
da6c37d7dc C#: Update test output. 2020-05-15 15:40:49 +01:00
Tom Hvitved
cd9538d0d9 Merge remote-tracking branch 'upstream/master' into dataflow/precise-field-types 2020-05-15 15:24:05 +02:00
Calum Grant
5787871734 Merge pull request #3351 from hvitved/csharp/unification-nested-types
C#: Teach unification library about nested types
2020-05-15 14:11:00 +01:00
Calum Grant
cc844648ff Merge pull request #3365 from hvitved/csharp/format-queries-path-problem
C#: Convert `string.format()` queries to path queries
2020-05-15 14:08:54 +01:00