2021-03-01 16:38:00 +00:00
|
|
|
import pixie/common, pixie/fileformats/gif, random, strformat
|
|
|
|
|
|
|
|
randomize()
|
|
|
|
|
2021-10-03 22:49:21 +00:00
|
|
|
let original = readFile("tests/fileformats/gif/sunflower.gif")
|
2021-03-01 16:38:00 +00:00
|
|
|
|
|
|
|
for i in 0 ..< 10_000:
|
|
|
|
var data = original
|
|
|
|
let
|
|
|
|
pos = rand(data.len)
|
|
|
|
value = rand(255).char
|
|
|
|
# pos = 27355
|
|
|
|
# value = '&'
|
|
|
|
data[pos] = value
|
|
|
|
echo &"{i} {pos} {value}"
|
|
|
|
try:
|
2022-06-14 02:47:39 +00:00
|
|
|
let img = newImage(decodeGif(data))
|
2021-03-01 16:38:00 +00:00
|
|
|
doAssert img.height > 0 and img.width > 0
|
|
|
|
except PixieError:
|
|
|
|
discard
|
|
|
|
|
|
|
|
data = data[0 ..< pos]
|
|
|
|
try:
|
2022-06-14 02:47:39 +00:00
|
|
|
let img = newImage(decodeGif(data))
|
2021-03-01 16:38:00 +00:00
|
|
|
doAssert img.height > 0 and img.width > 0
|
|
|
|
except PixieError:
|
|
|
|
discard
|