diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-28 10:44:16 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-28 10:44:16 +0100 |
| commit | 0838881b87f3a59ccd841d247e4b975347529220 (patch) | |
| tree | de0684bcf35e91c75ed5c615f88bc639fe4e2e44 /tests/test_library.py | |
| parent | d368de4b30d8a1dc9bb72ba45c55b07d3f034c82 (diff) | |
| download | generat3D-0838881b87f3a59ccd841d247e4b975347529220.tar.gz generat3D-0838881b87f3a59ccd841d247e4b975347529220.zip | |
Turn remaining malformed-input crashes into Error
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_library.py')
| -rw-r--r-- | tests/test_library.py | 16 |
1 files changed, 16 insertions, 0 deletions
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) |
