Fix some genSym issues causing C compilation errors
This commit is contained in:
parent
fcc5aa3a53
commit
d759496d08
|
@ -53,7 +53,7 @@ template initImpl(): untyped =
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
template init*(body: untyped) =
|
template init*(body: untyped) {.dirty.} =
|
||||||
## Init block to do any initialisation for the fuzzing test.
|
## Init block to do any initialisation for the fuzzing test.
|
||||||
##
|
##
|
||||||
## For AFL this is currently only cosmetic and will be run each time, before
|
## For AFL this is currently only cosmetic and will be run each time, before
|
||||||
|
@ -63,15 +63,17 @@ template init*(body: untyped) =
|
||||||
## stateless or make sure everything gets properply reset for each new run in
|
## stateless or make sure everything gets properply reset for each new run in
|
||||||
## the test block.
|
## the test block.
|
||||||
when defined(libFuzzer):
|
when defined(libFuzzer):
|
||||||
template initImpl() =
|
template initImpl() {.dirty.} =
|
||||||
proc fuzzerInit(): cint {.exportc: "LLVMFuzzerInitialize".} =
|
proc fuzzerInit(): cint {.exportc: "LLVMFuzzerInitialize".} =
|
||||||
NimMain()
|
NimMain()
|
||||||
|
|
||||||
`body`
|
body
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
template initImpl(): untyped = fuzz: `body`
|
template initImpl(): untyped {.dirty.} =
|
||||||
|
bind fuzz
|
||||||
|
fuzz: body
|
||||||
|
|
||||||
template test*(body: untyped): untyped =
|
template test*(body: untyped): untyped =
|
||||||
## Test block to do the actual test that will be fuzzed in a loop.
|
## Test block to do the actual test that will be fuzzed in a loop.
|
||||||
|
@ -86,16 +88,16 @@ template test*(body: untyped): untyped =
|
||||||
template payload(): auto =
|
template payload(): auto =
|
||||||
makeOpenArray(data, len)
|
makeOpenArray(data, len)
|
||||||
|
|
||||||
`body`
|
body
|
||||||
else:
|
else:
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
var payload {.inject.} = readStdin()
|
var payload {.inject.} = readStdin()
|
||||||
|
|
||||||
fuzz: `body`
|
fuzz: body
|
||||||
else:
|
else:
|
||||||
proc fuzzerCall() {.exportc: "AFLmain", dynlib, cdecl.} =
|
proc fuzzerCall() {.exportc: "AFLmain", dynlib, cdecl.} =
|
||||||
var payload {.inject.} = readStdin()
|
var payload {.inject.} = readStdin()
|
||||||
fuzz: `body`
|
fuzz: body
|
||||||
|
|
||||||
fuzzerCall()
|
fuzzerCall()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue