image-codecs tests: the gate flips and overwrites one value per sampled byte, rotating

This commit is contained in:
aiongg
2026-11-24 22:33:06 +00:00
parent 4c3fcafa01
commit 878b4ee811
2 changed files with 10 additions and 3 deletions
+5 -2
View File
@@ -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);
}
}
+5 -1
View File
@@ -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);