Skip to content

Reject zero-sized FIT field definitions with parse context - #41

Open
bensynapse wants to merge 1 commit into
polyvertex:masterfrom
bensynapse:fix-empty-field-definitions
Open

bensynapse wants to merge 1 commit into
polyvertex:masterfrom
bensynapse:fix-empty-field-definitions

Conversation

@bensynapse

Copy link
Copy Markdown

I maintain Live Tennis API.

Fixes #40. Reject zero-sized ordinary and developer field definitions immediately with FitParseError, including the field number and definition offset. Such files already fail in every error mode; this makes that failure actionable and catches it even without a following data message. Positive misaligned fields still use the existing byte fallback, and definitions with no fields remain valid.

Validation on Linux:

  • All 22 project tests pass on Python 3.10, 3.11, 3.12 and 3.13. The 24 zero-size regression cases fail on upstream and pass here; six compatibility cases cover existing recovery and empty definitions.
  • Source archive/wheel build and twine check pass. The installed wheel handles the issue's 26-byte reproduction in all three modes with offset 14, and still decodes a valid counterpart.
  • Changed production file passes Flake8. Full Flake8 has the same two existing B042 findings in fitdecode/exceptions.py on upstream and this branch.

Windows was not tested locally.

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.

Definition message with field_size == 0 surfaces later as a bare ValueError('size')

1 participant