Readability vectors: a legacy array with bytes after it
Rust's read path let a legacy envelope array with trailing bytes through when the whole-array check was loosened, and no vector caught it. Add the vector; every runtime refuses it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5d1fc496d7
commit
ae0f545a06
6 changed files with 7 additions and 3 deletions
|
|
@ -913,7 +913,7 @@ class CultCacheTests(unittest.TestCase):
|
|||
for line in (root / "manifest.txt").read_text(encoding="utf-8").splitlines()
|
||||
if line and not line.startswith("#")
|
||||
]
|
||||
self.assertEqual(len(rows), 14)
|
||||
self.assertEqual(len(rows), 15)
|
||||
envelopes = SingleFileMessagePackBackingStore(self._C2A_VECTORS / "v3-base.msgpack").pull_all()
|
||||
for vector, _, _, _, python in rows:
|
||||
content = (root / vector).read_bytes()
|
||||
|
|
|
|||
|
|
@ -4858,7 +4858,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(rows, 14);
|
||||
assert_eq!(rows, 15);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1590,7 +1590,7 @@ test("SingleFileMessagePackBackingStore replaces a file exactly when it reads",
|
|||
.split(/\r?\n/u)
|
||||
.filter((line) => line.length > 0 && !line.startsWith("#"))
|
||||
.map((line) => line.split(/\s+/u));
|
||||
assert.equal(rows.length, 14);
|
||||
assert.equal(rows.length, 15);
|
||||
const dir = await mkdtemp(join(tmpdir(), "cultcache-readability-"));
|
||||
const seed = await copyVector(dir, join(c2aVectors, "v3-base.msgpack"), "seed.msgpack");
|
||||
const envelopes = await new SingleFileMessagePackBackingStore(seed).pullAll();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ vectors = {
|
|||
"empty-array": pack([]),
|
||||
# A legacy envelope array: an array of maps. Rust, TypeScript and Python read it; C# has no legacy reader.
|
||||
"legacy-envelopes": pack([{"key": "old", "type": "old.type", "payload": pack([]), "storedAt": "2026-01-01T00:00:00Z"}]),
|
||||
"legacy-trailing": None, # filled below: the legacy array plus bytes after it
|
||||
"ints": pack([1, 2, 3]),
|
||||
"nil-first": pack([None, "x"]),
|
||||
"nested-array": pack([["cultcache.store.v9", [], []]]),
|
||||
|
|
@ -28,6 +29,7 @@ vectors = {
|
|||
"trailing-bytes": whole + b"\x01\x02\x03",
|
||||
"trailing-store": whole + whole,
|
||||
}
|
||||
vectors["legacy-trailing"] = vectors["legacy-envelopes"] + b""
|
||||
for name, data in vectors.items():
|
||||
(here / f"{name}.bin").write_bytes(data)
|
||||
print(len(vectors), "vectors")
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
‘„£key£old¤type¨old.type§payloadÄ<01>¨storedAt´2026-01-01T00:00:00Z
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
zero-byte.bin reads reads reads reads
|
||||
empty-array.bin reads reads reads reads
|
||||
legacy-envelopes.bin refuses reads reads reads
|
||||
legacy-trailing.bin refuses refuses refuses refuses
|
||||
ints.bin refuses refuses refuses refuses
|
||||
nil-first.bin refuses refuses refuses refuses
|
||||
nested-array.bin refuses refuses refuses refuses
|
||||
|
|
|
|||
Loading…
Reference in a new issue