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

header tag length is zero #37

Open
sususu98 opened this issue Jul 25, 2022 · 4 comments
Open

header tag length is zero #37

sususu98 opened this issue Jul 25, 2022 · 4 comments

Comments

@sususu98
Copy link

https://github.com/Riscure/python-trsfile/blob/1ac882d45bcc72825f5ff2113200bc8182b5a39d/trsfile/engine/trs.py#L518

@sususu98 sususu98 changed the title XS header tag length is zero Jul 25, 2022
@sususu98
Copy link
Author

while Header.TRACE_BLOCK not in self.headers:
			# Obtain the Tag
			tag = self.handle.read(1)[0]

			# Obtain the Length
			tag_length = self.handle.read(1)[0]

			if (tag_length & 0x80) != 0:
				tag_length = int.from_bytes(self.handle.read(tag_length & 0x7F), 'little')
			if tag_length==0 and tag!=0x5f :
				continue

@TomHogervorst
Copy link
Contributor

Aplogies for the late reply. In which situation did you encounter an issue with the tag length being zero? Could you help me reproduce the bug that your suggestion fixes?

@aickerso aickerso added good first issue Good for newcomers and removed good first issue Good for newcomers labels Jul 1, 2024
@SkyLineBeyonder
Copy link

image
The code here lacks a check for whether tag_value is of NoneType. When tag_length is 0, tag_value will be set to NoneType, leading to errors during subsequent parsing of tag_value.

@SkyLineBeyonder
Copy link

SU provided a temporary solution for this bug.
#37 (comment)

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

No branches or pull requests

4 participants