pixie/tests/fuzz_svg.nim

18 lines
362 B
Nim
Raw Normal View History

2020-12-04 18:13:01 +00:00
import random, strformat, pixie/fileformats/svg, pixie/common
randomize()
let original = readFile("tests/images/svg/Ghostscript_Tiger.svg")
for i in 0 ..< 10_000:
var data = original
let
pos = rand(data.len)
value = rand(255).char
data[pos] = value
echo &"{i} {pos} {value}"
try:
discard decodeSvg(data)
except PixieError:
discard