Skip to content

Fix parsing bugs in ClassificationElement, DirectDateTimeElement and IDContainer#115

Open
Mic92 wants to merge 3 commits into
pretix:masterfrom
Mic92:parsing-fixes
Open

Fix parsing bugs in ClassificationElement, DirectDateTimeElement and IDContainer#115
Mic92 wants to merge 3 commits into
pretix:masterfrom
Mic92:parsing-fixes

Conversation

@Mic92

@Mic92 Mic92 commented Jul 15, 2026

Copy link
Copy Markdown

I did some fuzzing:

  • ClassificationElement.from_etree cast text to Decimal, crashing on alphanumeric class codes
  • DirectDateTimeElement.from_etree dropped the time part and swallowed parse errors; now keeps the datetime and raises in strict mode
  • IDContainer.add_from_etree raised KeyError when the optional schemeID attribute was missing

Each fix comes with a regression test.

Mic92 added 3 commits July 15, 2026 08:56
from_etree converted the element text to Decimal, which crashes on
alphanumeric classification codes and breaks roundtripping since the
value is a code, not a number.
from_etree dropped the time component via .date() even though to_etree
serializes with %H:%M:%S, so roundtrips silently lost data. It also
swallowed all parse errors and stored an empty string instead of
failing in strict mode.
schemeID is optional on ID elements, but add_from_etree accessed the
attribute directly and raised KeyError when parsing documents without
it.
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.

1 participant