mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 09:08:11 +00:00
image-codecs tests: the gate flips and overwrites one value per sampled byte, rotating
This commit is contained in:
@@ -99,9 +99,12 @@ fn byte_overwrites_in_header_never_panic() {
|
||||
let step = craft_media_testkit::hostile::divisor();
|
||||
for (k, (f, bytes)) in samples().into_iter().enumerate() {
|
||||
for i in (0..bytes.len().min(64)).filter(|i| (i + k) % step == 0) {
|
||||
for v in [0x00, 0x7F, 0xFF] {
|
||||
// nightly writes every value to each byte; the gate one per byte, rotating, so the sampled bytes together see all
|
||||
let values = [0x00, 0x7F, 0xFF];
|
||||
let one = [values[(i / step) % 3]];
|
||||
for v in if step == 1 { &values[..] } else { &one[..] } {
|
||||
let mut b = bytes.clone();
|
||||
b[i] = v;
|
||||
b[i] = *v;
|
||||
no_panic(f, &b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,7 +840,11 @@ fn zoo_decodes_and_never_panics_when_cut_or_corrupted() {
|
||||
poke(&f[..cut]);
|
||||
}
|
||||
for i in (0..f.len()).filter(|i| (i + k) % step == 0) {
|
||||
for flip in [0xffu8, 0x80, 0x01] {
|
||||
// nightly flips each byte three ways; the gate one way per byte, rotating, so the sampled bytes together see all
|
||||
let flips = [0xffu8, 0x80, 0x01];
|
||||
let one = [flips[(i / step) % 3]];
|
||||
for flip in if step == 1 { &flips[..] } else { &one[..] } {
|
||||
let flip = *flip;
|
||||
let mut g = f.clone();
|
||||
g[i] ^= flip;
|
||||
poke(&g);
|
||||
|
||||
Reference in New Issue
Block a user