Skip to content

Commit 69c88b5

Browse files
committed
add custom corpus import mode for db sync
1 parent 89b2a8e commit 69c88b5

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

Sources/Fuzzilli/Base/ProgramOrigin.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ public enum CorpusImportMode: Equatable {
7575
/// Only programs that increase coverage are included in the fuzzing corpus.
7676
case interestingOnly(shouldMinimize: Bool)
7777

78+
/// The program was synced from postgres
79+
case databaseSync
80+
7881
public func requiresMinimization() -> Bool {
7982
switch self {
8083
case .full:
8184
return false
8285
case .interestingOnly(let shouldMinimize):
8386
return shouldMinimize
87+
case .databaseSync:
88+
return false
8489
}
8590
}
8691
}

Sources/Fuzzilli/Fuzzer.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,11 @@ public class Fuzzer {
771771
}
772772
}
773773
assert(!program.code.contains(where: { $0.op is JsInternalOperation }))
774-
dispatchEvent(events.InterestingProgramFound, data: (program, aspects, origin, execution))
774+
775+
// Don't dispatch events for programs synced from the database
776+
if origin != .corpusImport(mode: .databaseSync) {
777+
dispatchEvent(events.InterestingProgramFound, data: (program, aspects, origin, execution))
778+
}
775779

776780
// If we're running in static corpus mode, we only add programs to our corpus during corpus import.
777781
if !config.staticCorpus || origin.isFromCorpusImport() {

Sources/Fuzzilli/Modules/PostgreSQLSync.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class PostgreSQLSync: Module {
7070
// Import each program into the fuzzer's corpus
7171
for program in programs {
7272
fuzzer.async {
73-
fuzzer.importProgram(program, origin: .corpusImport(mode: .full), enableDropout: false)
73+
fuzzer.importProgram(program, origin: .corpusImport(mode: .databaseSync), enableDropout: false)
7474
}
7575
}
7676

@@ -413,7 +413,7 @@ public class PostgreSQLSync: Module {
413413

414414
for (program, _) in newPrograms {
415415
fuzzer.async {
416-
fuzzer.importProgram(program, origin: .corpusImport(mode: .full), enableDropout: false)
416+
fuzzer.importProgram(program, origin: .corpusImport(mode: .databaseSync), enableDropout: false)
417417
}
418418
}
419419
}

0 commit comments

Comments
 (0)