From 0838881b87f3a59ccd841d247e4b975347529220 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 28 Oct 2026 10:44:16 +0100 Subject: Turn remaining malformed-input crashes into Error Co-Authored-By: Claude Sonnet 5.5 --- tests/test_library.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test_library.py') diff --git a/tests/test_library.py b/tests/test_library.py index 84fa3cc..7e06ca4 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -89,3 +89,19 @@ class LibraryTest(unittest.TestCase): p = Path(self.tmp.name) / "x.duf" p.write_text(json.dumps({"x": 1})) self.assertEqual(read_dson(p), {"x": 1}) + + +class ReadDsonCrashTest(unittest.TestCase): + def read(self, data): + with tempfile.TemporaryDirectory() as d: + p = Path(d) / "x.dsf" + p.write_bytes(data) + read_dson(p) + + def test_corrupt_gzip_is_error(self): + with self.assertRaises(Error): + self.read(b"\x1f\x8b\x08\x00" + b"\xff" * 20) + + def test_deep_nesting_is_error(self): + with self.assertRaises(Error): + self.read(b"[" * 200000) -- cgit v1.2.3