diff --git a/pyproject.toml b/pyproject.toml index 34a049e..1daed1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ dependencies = [ # TIFF or PDF within our limits (imaging.open_image and check_pdf). Grew # out of this package; 0.x minor releases are additive, a breaking one # becomes 1.0 and stops at the ceiling. - "sillybos>=5,<6", + "sillybos>=6,<7", "python-dotenv>=1.0", # Writes the searchable PDF. Core rather than an extra because the roadmap # treats that as the flagship catalogue-ready output, and it should work on diff --git a/tests/ocr/test_input_limits.py b/tests/ocr/test_input_limits.py index 04dd713..ddc9f85 100644 --- a/tests/ocr/test_input_limits.py +++ b/tests/ocr/test_input_limits.py @@ -166,6 +166,38 @@ def test_a_tiff_whose_tags_contradict_each_other_is_refused(self, tmp_path: Path open_image(path) +class TestTagData: + def test_a_tiff_whose_tags_all_claim_the_same_bytes_is_refused(self, tmp_path: Path) -> None: + """sillybos 6 refuses tags that claim more data than the file holds; the reason reaches triage.""" + import struct + + # One greyscale pixel and a hundred private tags that each claim nearly + # the whole file. A decoder reads every tag's value into memory, so a + # file of a few kilobytes costs it megabytes (CVE-2026-128066). + image = [ + (256, 3, 1, 1), # ImageWidth + (257, 3, 1, 1), # ImageLength + (258, 3, 1, 8), # BitsPerSample + (259, 3, 1, 1), # Compression: none + (262, 3, 1, 1), # PhotometricInterpretation: black is zero + (273, 4, 1, 0), # StripOffsets: the pixel is a header byte + (278, 3, 1, 1), # RowsPerStrip + (279, 4, 1, 1), # StripByteCounts + ] + claims = 100 + size = 8 + 2 + 12 * (len(image) + claims) + 4 + entries = image + [(40000 + k, 1, size - 8, 8) for k in range(claims)] + ifd = struct.pack(" None: image = page() diff --git a/uv.lock b/uv.lock index 5fa0be2..58dc7ac 100644 --- a/uv.lock +++ b/uv.lock @@ -4826,11 +4826,11 @@ wheels = [ [[package]] name = "sillybos" -version = "5.0.0" +version = "6.0.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/1e/4b/2afcb5f406492f7748f7053c3666be0bb9a75d98a57fe51f8d68c01d85a0/sillybos-5.0.0.tar.gz", hash = "sha256:f5f9b2f18dc0d396aacc3e1ad8ee7537749e6f67dfb42997a3a45863802e32d8", size = 655464, upload-time = "2026-11-03T17:11:19.194Z" } +sdist = { url = "https://files.pythonhosted.org/packages/d1/20/4ca33faac6fc1cb6201ee0ab1991a6c623176de6e7b50e5f61470ef4a7f7/sillybos-6.0.1.tar.gz", hash = "sha256:c27f74bff8981037865e636fc09ba74b01cf9149c729918b56b0e771dc3d6b4a", size = 672830, upload-time = "2026-11-17T09:34:38.553Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d9/dd/e066e4eca9f8d3dda19a1eb944eff4b024c5d12b05cf65eec7b782f0cec4/sillybos-5.0.0-py3-none-any.whl", hash = "sha256:46da1e20355490dfaf10944120a5c01b46b9436afdb3fcc4245f464bfee8b4d8", size = 43122, upload-time = "2026-11-03T17:11:17.484Z" }, + { url = "https://files.pythonhosted.org/packages/59/22/273c3759af98a91c8b804bdedb7abcad4076db2991a359a1f4f2aa0cb5a9/sillybos-6.0.1-py3-none-any.whl", hash = "sha256:3318dc30033bf21e83ae89977dc52d211d4bb55cb15d7e3017ec92ed786c95d7", size = 48665, upload-time = "2026-11-17T09:34:37.029Z" }, ] [[package]] @@ -5251,7 +5251,7 @@ requires-dist = [ { name = "python-pptx", marker = "extra == 'docs'", specifier = ">=0.6" }, { name = "reportlab", specifier = ">=4.0" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.5" }, - { name = "sillybos", specifier = ">=5,<6" }, + { name = "sillybos", specifier = ">=6,<7" }, { name = "sphinx", marker = "extra == 'apidocs'", specifier = ">=8.0" }, { name = "sphinx-argparse", marker = "extra == 'apidocs'", specifier = ">=0.6.1" }, { name = "tetrak-easyocr-armenian", marker = "extra == 'armenian'", specifier = ">=0.12" },