Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
385 changes: 315 additions & 70 deletions Sources/Fuzzilli/Corpus/PostgreSQLCorpus.swift

Large diffs are not rendered by default.

57 changes: 49 additions & 8 deletions Sources/Fuzzilli/Database/DatabaseUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,50 @@ public class DatabaseUtils {
public static func mapExecutionOutcome(outcome: ExecutionOutcome) -> Int {
switch outcome {
case .succeeded:
return 1
return 3 // Succeeded maps to ID 3
case .failed:
return 2
return 2 // Failed maps to ID 2
case .crashed:
return 3
return 1 // Crashed maps to ID 1
case .timedOut:
return 4
return 4 // TimedOut maps to ID 4
}
}

/// Map ExecutionOutcome with signal code to database ID
/// Signal 11 (SIGSEGV) and 7 (SIGBUS) are real crashes
/// Signal 5 (SIGTRAP) and 6 (SIGABRT) are sig checks
public static func mapExecutionOutcomeWithSignal(outcome: ExecutionOutcome, signalCode: Int?) -> Int {
switch outcome {
case .succeeded:
return 3 // Succeeded maps to ID 3
case .failed:
return 2 // Failed maps to ID 2
case .crashed(let signal):
// Check if this is a real crash or just a signal check
if signal == 11 || signal == 7 {
return 1 // Real crashes: SIGSEGV (11) and SIGBUS (7)
} else {
return 34 // SigCheck: SIGTRAP (5), SIGABRT (6), and others
}
case .timedOut:
return 4 // TimedOut maps to ID 4
}
}

/// Map database ID to ExecutionOutcome
public static func mapExecutionOutcomeFromId(id: Int) -> ExecutionOutcome {
switch id {
case 1:
return .succeeded
return .crashed(1) // ID 1 = Crashed (real crashes)
case 2:
return .failed(1) // Default exit code
return .failed(1) // ID 2 = Failed
case 3:
return .crashed(1) // Default signal
return .succeeded // ID 3 = Succeeded
case 4:
return .timedOut
return .timedOut // ID 4 = TimedOut
case 34:
return .crashed(5) // ID 34 = SigCheck (signal checks)
default:
return .succeeded // Default fallback
}
Expand Down Expand Up @@ -355,6 +378,24 @@ public enum DatabaseUtilsError: Error, LocalizedError {
return "Invalid metadata format"
}
}

/// Map execution outcome string to database ID
public static func mapExecutionOutcomeFromString(_ outcome: String) -> Int {
switch outcome.lowercased() {
case "crashed":
return 1
case "failed":
return 2
case "succeeded":
return 3
case "timedout":
return 4
case "sigcheck":
return 34
default:
return 3 // Default to succeeded
}
}
}

// MARK: - Extensions
Expand Down
Loading
Loading