Skip to content

Harden PayloadBuffer against hostile wire data - #26

Open
dallison wants to merge 2 commits into
mainfrom
bounds_fixes
Open

Harden PayloadBuffer against hostile wire data#26
dallison wants to merge 2 commits into
mainfrom
bounds_fixes

Conversation

@dallison

Copy link
Copy Markdown
Owner

Summary

  • Add size-aware GetString/GetStringView overloads that clamp stored string lengths to the received buffer size
  • Fix IsPresent to use 32-bit word indexing (matching setters) with null-safe bounds checks
  • Make IsValidAddress overflow-safe by comparing offsets instead of forming out-of-range end pointers
  • Add regression test HostileStringLengthIsClamped

Test plan

  • bazel test //... (macOS)
  • bazel test //... --config=asan (Linux via Colima)

Add size-aware string readers that clamp stored lengths to the received
buffer, fix IsPresent bit indexing, and make IsValidAddress overflow-safe
so untrusted payloads cannot cause out-of-bounds reads.
Start-only bounds checks let a uint32_t length word near the end of a
hostile buffer through, causing ASan heap-buffer-overflow in BoundedString.
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