Skip to content

Validate payload reads and entrypoint bounds#4

Closed
ericlewis wants to merge 1 commit into
codex/define-loader-runtime-contractfrom
codex/harden-payload-load
Closed

Validate payload reads and entrypoint bounds#4
ericlewis wants to merge 1 commit into
codex/define-loader-runtime-contractfrom
codex/harden-payload-load

Conversation

@ericlewis

Copy link
Copy Markdown
Collaborator

Summary

  • Check header and payload reads for exact lengths.
  • Reject empty, too large, or overflowed payload sizes.
  • Validate the entry point is inside the loaded payload.
  • Use fixed-width integer and address-sized math.

Why

payload.bin can be missing, cut short, or changed. The loader used to trust the size and entry point from that file. A bad file could make the loader read into the wrong memory or jump outside the payload.

Verification

  • python3 generate_start.py
  • cmake -S . -B /tmp/playbrew-verify-harden-payload-load
  • cmake --build /tmp/playbrew-verify-harden-payload-load
  • git diff --check

@ericlewis ericlewis changed the title [codex] Validate payload reads and entrypoint bounds Validate payload reads and entrypoint bounds May 10, 2026
@ericlewis ericlewis added security Input validation and hardening firmware Firmware hooks, patching, and version-specific code labels May 10, 2026
@ericlewis ericlewis self-assigned this May 10, 2026
@ericlewis ericlewis marked this pull request as ready for review May 10, 2026 04:50
Why: payload.bin can be missing, cut short, or changed. The loader used to trust the size and entry point from that file without checking them. A bad file could make the loader read into the wrong memory or jump outside the payload. This checks the reads and only runs the payload when the size and entry point are safe.
@ericlewis ericlewis force-pushed the codex/harden-payload-load branch from 9d0bcca to 24139dc Compare May 10, 2026 05:09
@ericlewis ericlewis changed the base branch from main to codex/define-loader-runtime-contract May 10, 2026 05:10
@ericlewis

Copy link
Copy Markdown
Collaborator Author

Replaced by #12 with the cleaned branch name.

@ericlewis ericlewis closed this May 10, 2026
@ericlewis ericlewis deleted the codex/harden-payload-load branch May 10, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

firmware Firmware hooks, patching, and version-specific code security Input validation and hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant