Skip to content

Commit 9dd3689

Browse files
authored
Merge pull request #31 from ol2764RIT/postgres-error-fixing
fixed issue with intersting corpus not updating
2 parents 7d0f2e4 + 600ca60 commit 9dd3689

7 files changed

Lines changed: 853 additions & 127 deletions

File tree

Sources/Fuzzilli/Corpus/PostgreSQLCorpus.swift

Lines changed: 315 additions & 70 deletions
Large diffs are not rendered by default.

Sources/Fuzzilli/Database/DatabaseUtils.swift

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,50 @@ public class DatabaseUtils {
100100
public static func mapExecutionOutcome(outcome: ExecutionOutcome) -> Int {
101101
switch outcome {
102102
case .succeeded:
103-
return 1
103+
return 3 // Succeeded maps to ID 3
104104
case .failed:
105-
return 2
105+
return 2 // Failed maps to ID 2
106106
case .crashed:
107-
return 3
107+
return 1 // Crashed maps to ID 1
108108
case .timedOut:
109-
return 4
109+
return 4 // TimedOut maps to ID 4
110+
}
111+
}
112+
113+
/// Map ExecutionOutcome with signal code to database ID
114+
/// Signal 11 (SIGSEGV) and 7 (SIGBUS) are real crashes
115+
/// Signal 5 (SIGTRAP) and 6 (SIGABRT) are sig checks
116+
public static func mapExecutionOutcomeWithSignal(outcome: ExecutionOutcome, signalCode: Int?) -> Int {
117+
switch outcome {
118+
case .succeeded:
119+
return 3 // Succeeded maps to ID 3
120+
case .failed:
121+
return 2 // Failed maps to ID 2
122+
case .crashed(let signal):
123+
// Check if this is a real crash or just a signal check
124+
if signal == 11 || signal == 7 {
125+
return 1 // Real crashes: SIGSEGV (11) and SIGBUS (7)
126+
} else {
127+
return 34 // SigCheck: SIGTRAP (5), SIGABRT (6), and others
128+
}
129+
case .timedOut:
130+
return 4 // TimedOut maps to ID 4
110131
}
111132
}
112133

113134
/// Map database ID to ExecutionOutcome
114135
public static func mapExecutionOutcomeFromId(id: Int) -> ExecutionOutcome {
115136
switch id {
116137
case 1:
117-
return .succeeded
138+
return .crashed(1) // ID 1 = Crashed (real crashes)
118139
case 2:
119-
return .failed(1) // Default exit code
140+
return .failed(1) // ID 2 = Failed
120141
case 3:
121-
return .crashed(1) // Default signal
142+
return .succeeded // ID 3 = Succeeded
122143
case 4:
123-
return .timedOut
144+
return .timedOut // ID 4 = TimedOut
145+
case 34:
146+
return .crashed(5) // ID 34 = SigCheck (signal checks)
124147
default:
125148
return .succeeded // Default fallback
126149
}
@@ -355,6 +378,24 @@ public enum DatabaseUtilsError: Error, LocalizedError {
355378
return "Invalid metadata format"
356379
}
357380
}
381+
382+
/// Map execution outcome string to database ID
383+
public static func mapExecutionOutcomeFromString(_ outcome: String) -> Int {
384+
switch outcome.lowercased() {
385+
case "crashed":
386+
return 1
387+
case "failed":
388+
return 2
389+
case "succeeded":
390+
return 3
391+
case "timedout":
392+
return 4
393+
case "sigcheck":
394+
return 34
395+
default:
396+
return 3 // Default to succeeded
397+
}
398+
}
358399
}
359400

360401
// MARK: - Extensions

0 commit comments

Comments
 (0)