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

avoid crash on corrupt footer #99

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pyxdf/pyxdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,16 @@ def load_xdf(
elif tag == 6:
# read [StreamFooter] chunk
xml_string = f.read(chunklen - 6)
streams[StreamId]["footer"] = _xml2dict(fromstring(xml_string))
try:
streams[StreamId]["footer"] = _xml2dict(fromstring(xml_string))
except Exception as e:
if type(e).__name__ == 'ParseError':
logger.error(
"found likely XDF file corruption (%s), "
"ignoring corrupted XML element in footer." % e
)
else:
raise
cbrnr marked this conversation as resolved.
Show resolved Hide resolved
elif tag == 4:
# read [ClockOffset] chunk
temp[StreamId].clock_times.append(
Expand Down