Skip to content

Fix potential OOB-read in delta diff#719

Merged
dgarske merged 3 commits intowolfSSL:masterfrom
danielinux:fixes-20260310
Mar 11, 2026
Merged

Fix potential OOB-read in delta diff#719
dgarske merged 3 commits intowolfSSL:masterfrom
danielinux:fixes-20260310

Conversation

@danielinux
Copy link
Member

F/434 - potential out-of-bounds read while creating the patch

Also includes minor unrelated fix:

F/436: Added missing parenthesis around macro

Copilot AI review requested due to automatic review settings March 10, 2026 16:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a potential out-of-bounds read in wb_diff() when extending matches to the end of the input buffers, and adds unit tests to reproduce those edge cases. Also includes a small macro correctness tweak.

Changes:

  • Add bounds checks in wb_diff() match-extension loops to prevent OOB reads.
  • Add new unit tests covering “match extends to end of src_b” scenarios.
  • Fix a macro precedence issue by adding missing parentheses.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tools/unit-tests/unit-delta.c Adds regression tests for the OOB scenario; refactors buffer initialization helper.
src/delta.c Adds bounds checks to prevent match-extension loops from reading past buffer ends.
src/libwolfboot.c Wraps a macro expression in parentheses to avoid precedence issues.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgarske dgarske merged commit 756d569 into wolfSSL:master Mar 11, 2026
321 of 322 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.

3 participants