Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ascii values without \x00 ending #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EasyIsrael
Copy link

@EasyIsrael EasyIsrael commented Jan 19, 2022

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

the Github- project exifread solves this problem the same way. Have a look at
https://github.com/ianare/exif-py/blob/develop/exifread/classes.py in method _process_field2 on line 193.

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
@@ -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]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is uncovered, data = data.split(b'\x00', 1)[0] should be after if statement.

mikhail-iurkov added a commit to uploadcare/Piexif that referenced this pull request Jan 20, 2022
mikhail-iurkov added a commit to uploadcare/Piexif that referenced this pull request Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants