fuzz jpg
This commit is contained in:
parent
8ed2c7a5b3
commit
c27616fc32
17
tests/fuzz_jpg.nim
Normal file
17
tests/fuzz_jpg.nim
Normal file
|
@ -0,0 +1,17 @@
|
|||
import random, strformat, pixie/fileformats/jpg, pixie/common
|
||||
|
||||
randomize()
|
||||
|
||||
let original = cast[seq[uint8]](readFile("tests/images/jpg/jpeg420exif.jpg"))
|
||||
|
||||
for i in 0 ..< 10_000:
|
||||
var data = original
|
||||
let
|
||||
pos = rand(data.len)
|
||||
value = rand(255).uint8
|
||||
data[pos] = value
|
||||
echo &"{i} {pos} {value}"
|
||||
try:
|
||||
discard decodeJpg(data)
|
||||
except PixieError:
|
||||
discard
|
Loading…
Reference in a new issue