From 5e01f55b7b43e9a9057596a3afaaf4bad7e86f2a Mon Sep 17 00:00:00 2001 From: Martin Israel Date: Wed, 19 Jan 2022 10:46:32 +0100 Subject: [PATCH] ascii values without \x00 ending in some images there are ascii values without terminating null character ( \x00 ). this is a fix for that case. It reduces all characters after a null character in an ascii text --- piexif/_load.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/piexif/_load.py b/piexif/_load.py index 6176028..8274f58 100644 --- a/piexif/_load.py +++ b/piexif/_load.py @@ -153,7 +153,8 @@ def convert_value(self, val): elif t == TYPES.Ascii: # ASCII if length > 4: pointer = struct.unpack(self.endian_mark + "L", value)[0] - data = self.tiftag[pointer: pointer+length - 1] + data = self.tiftag[pointer: pointer+length] + data = data.split(b'\x00', 1)[0] else: data = value[0: length - 1] elif t == TYPES.Short: # SHORT