Skip to content

blf: validate object bounds before unpacking payloads - #2132

Merged
zariiii9003 merged 2 commits into
hardbyte:mainfrom
CAOShurong:codex/blf-object-bounds
Nov 22, 2026
Merged

zariiii9003 merged 2 commits into
hardbyte:mainfrom
CAOShurong:codex/blf-object-bounds

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Summary of Changes

A truncated BLF object can consume bytes from the following object because unpacking uses the whole container buffer. For example, a 44-byte CAN_MESSAGE object can return the next object's LOBJ signature as four data bytes.

Validate the full versioned header and each supported message's fixed-size payload before unpacking. Add regressions for both header versions and all five message types, plus controls for minimum valid sizes and unknown objects. Existing CAN_FD_MESSAGE_64 zero-padding behavior is preserved.

Related Issues / Pull Requests

Related to #2109; this covers undersized headers and payloads beyond the base-header size check.

Type of Change

  • Bug fix

Checklist

  • I have followed the contribution guide.
  • I have added tests and a news fragment.
  • All checks and tests pass (tox).

Additional Notes

On Windows/Python 3.14, the log-format suite passes 107 tests (18 skipped), from source and the built wheel. Twelve new malformed-object cases fail on unchanged main. Installed API/CLI checks, Black, Ruff, build and strict Twine checks pass.

The full suite and some type/lint/docs commands retain Windows/environment failures; those checks are not claimed as passing. Physical CAN hardware was not tested.

@zariiii9003

Copy link
Copy Markdown
Collaborator

Change looks good. Please rename the news fragment to use the PR number.

@zariiii9003 zariiii9003 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@zariiii9003
zariiii9003 merged commit 955b824 into hardbyte:main Nov 22, 2026
26 of 27 checks passed
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.

2 participants