Skip to content

Commit 3e0245a

Browse files
committed
Fix test case for RuntimeChecksBypass
1 parent 90acd8c commit 3e0245a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

csharp/ql/test/query-tests/Security Features/CWE-020/RuntimeChecksBypass.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ public Test1(string v)
1717
[OnDeserializing]
1818
public void Deserialize()
1919
{
20-
f = $"invalid"; // BAD
20+
f = GetString(); // BAD, non-constant and non-object creation expr
2121
}
22+
23+
string GetString() { throw null; }
2224
}
2325

2426
[Serializable]
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
| RuntimeChecksBypass.cs:124:15:124:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:112:16:112:18 | Age | Age | RuntimeChecksBypass.cs:116:9:117:53 | if (...) ... | check |
2-
| RuntimeChecksBypass.cs:168:15:168:17 | access to local variable age | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:153:16:153:18 | Age | Age | RuntimeChecksBypass.cs:157:9:158:53 | if (...) ... | check |
1+
| RuntimeChecksBypass.cs:20:13:20:23 | call to method GetString | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:7:19:7:19 | f | f | RuntimeChecksBypass.cs:11:9:14:9 | if (...) ... | check |
2+
| RuntimeChecksBypass.cs:126:15:126:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:114:16:114:18 | Age | Age | RuntimeChecksBypass.cs:118:9:119:53 | if (...) ... | check |
3+
| RuntimeChecksBypass.cs:170:15:170:17 | access to local variable age | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:155:16:155:18 | Age | Age | RuntimeChecksBypass.cs:159:9:160:53 | if (...) ... | check |
34
| RuntimeChecksBypassBad.cs:19:15:19:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypassBad.cs:7:16:7:18 | Age | Age | RuntimeChecksBypassBad.cs:11:9:12:53 | if (...) ... | check |

0 commit comments

Comments
 (0)