Skip to content

Commit b3cafbb

Browse files
committed
fix csharp report
1 parent defe5f7 commit b3cafbb

File tree

3 files changed

+91
-2
lines changed

3 files changed

+91
-2
lines changed

casr/src/bin/casr-csharp.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ fn main() -> Result<()> {
122122
csharp_stderr.split('\n').map(|l| l.to_string()).collect();
123123
let re = Regex::new(r"^Unhandled [Ee]xception(?::\n|\. ).*").unwrap();
124124
if let Some(start) = csharp_stderr_list.iter().position(|x| re.is_match(x)) {
125-
report.csharp_report = csharp_stderr_list[start..].to_vec();
125+
let end = csharp_stderr_list[start..]
126+
.iter()
127+
.rposition(|x| !x.is_empty())
128+
.unwrap()
129+
+ 1;
130+
report.csharp_report = csharp_stderr_list[start..end].to_vec();
126131
let report_str = report.csharp_report.join("\n");
127132
report.stacktrace = CSharpStacktrace::extract_stacktrace(&report_str)?;
128133
if let Some(exception) = CSharpException::parse_exception(&report_str) {

csharp.casrep

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"Date": "2024-04-03T12:45:38.788982+03:00",
3+
"Uname": "Linux nick 5.15.0-79-generic #86~20.04.2-Ubuntu SMP Mon Jul 17 23:27:17 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux",
4+
"OS": "Ubuntu",
5+
"OSRelease": "20.04",
6+
"Architecture": "amd64",
7+
"ExecutablePath": "casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.csproj",
8+
"ProcEnviron": [
9+
"GJS_DEBUG_TOPICS=JS ERROR;JS LOG",
10+
"IM_CONFIG_PHASE=1",
11+
"COLORTERM=truecolor",
12+
"QT_IM_MODULE=ibus",
13+
"USER=headshog",
14+
"HOME=/home/headshog",
15+
"GJS_DEBUG_OUTPUT=stderr",
16+
"PWD=/home/headshog/casr",
17+
"_=/home/headshog/casr/./target/debug/casr-csharp",
18+
"JOURNAL_STREAM=8:2212765",
19+
"WINDOWPATH=2",
20+
"MANAGERPID=2410990",
21+
"PATH=/home/headshog/.cargo/bin:/home/headshog/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/headshog/.dotnet/tools",
22+
"XMODIFIERS=@im=ibus",
23+
"QT_ACCESSIBILITY=1",
24+
"SHELL=/bin/zsh",
25+
"VTE_VERSION=6003",
26+
"INVOCATION_ID=77de27253478465ba8558472de9846f7",
27+
"SHLVL=1",
28+
"DISPLAY=:0",
29+
"TERM=xterm-256color",
30+
"GDMSESSION=ubuntu",
31+
"OLDPWD=/home/headshog/casr/target",
32+
"ZSH=/home/headshog/.oh-my-zsh",
33+
"PAGER=less",
34+
"LESS=-R",
35+
"LSCOLORS=Gxfxcxdxbxegedabagacad"
36+
],
37+
"ProcCmdline": "dotnet run --project casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.csproj",
38+
"Stdin": "",
39+
"ProcStatus": [],
40+
"ProcMaps": [],
41+
"ProcFiles": [],
42+
"NetworkConnections": [],
43+
"CrashSeverity": {
44+
"Type": "NOT_EXPLOITABLE",
45+
"ShortDescription": "System.ArgumentException",
46+
"Description": "Parameter cannot be null",
47+
"Explanation": ""
48+
},
49+
"Stacktrace": [
50+
"at Program.f2() in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 14",
51+
"at Program.f1() in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 10",
52+
"at Program.Main(String[] args) in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 6"
53+
],
54+
"Registers": {},
55+
"Disassembly": [],
56+
"Package": "",
57+
"PackageVersion": "",
58+
"PackageArchitecture": "",
59+
"PackageDescription": "",
60+
"AsanReport": [],
61+
"UbsanReport": [],
62+
"PythonReport": [],
63+
"GoReport": [],
64+
"JavaReport": [],
65+
"RustReport": [],
66+
"JsReport": [],
67+
"CSharpReport": [
68+
"Unhandled exception. System.ArgumentException: Parameter cannot be null",
69+
" at Program.f2() in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 14",
70+
" at Program.f1() in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 10",
71+
" at Program.Main(String[] args) in /home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:line 6"
72+
],
73+
"CrashLine": "/home/headshog/casr/casr/tests/casr_tests/csharp/test_casr_csharp/test_casr_csharp.cs:14",
74+
"Source": [
75+
" 10 f2();",
76+
" 11 }",
77+
" 12 ",
78+
" 13 public static void f2() {",
79+
"--->14 throw new ArgumentException(\"Parameter cannot be null\");",
80+
" 15 }",
81+
" 16 }"
82+
]
83+
}

libcasr/src/csharp.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ impl Exception for CSharpException {
137137
.split_once(": ")?;
138138

139139
Some(ExecutionClass {
140+
severity: "NOT_EXPLOITABLE".to_string(),
140141
short_description: exception.to_string(),
141142
description: message.to_string(),
142-
..ExecutionClass::default()
143+
explanation: "".to_string(),
143144
})
144145
}
145146
}

0 commit comments

Comments
 (0)