Keysight/python-trsfile

header tag length is zero

Closed this issue · 4 comments

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

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?

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.

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