Skip to content

blf: validate object bounds before unpacking payloads - #2132

Open
CAOShurong wants to merge 1 commit into
hardbyte:mainfrom
CAOShurong:codex/blf-object-bounds
Open

CAOShurong wants to merge 1 commit into
hardbyte:mainfrom
CAOShurong:codex/blf-object-bounds

Conversation

@CAOShurong

Copy link
Copy Markdown

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.

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