From 7890e3891070167f44205cb1da9e36684c177573 Mon Sep 17 00:00:00 2001 From: thez3ro Date: Fri, 29 Nov 2024 11:05:03 +0100 Subject: [PATCH] fix Ascii IFD reading as TIFF6.0 spec --- src/docx/image/tiff.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/docx/image/tiff.py b/src/docx/image/tiff.py index 1194929af..3f44ca211 100644 --- a/src/docx/image/tiff.py +++ b/src/docx/image/tiff.py @@ -236,6 +236,8 @@ def _parse_value(cls, stream_rdr, offset, value_count, value_offset): The length of the string, including a terminating '\x00' (NUL) character, is in `value_count`. """ + if value_count <= 4: + return stream_rdr.read_str(value_count - 1, offset + 8) return stream_rdr.read_str(value_count - 1, value_offset)