Skip to content

Fix off-by-one in wh_Utils_memeqzero that skipped checking buffer[0]#304

Merged
bigbrett merged 1 commit intomainfrom
Zero-check
Mar 17, 2026
Merged

Fix off-by-one in wh_Utils_memeqzero that skipped checking buffer[0]#304
bigbrett merged 1 commit intomainfrom
Zero-check

Conversation

@jackctj117
Copy link
Copy Markdown
Contributor

This pull request makes a small correction to the wh_Utils_memeqzero function in src/wh_utils.c, fixing the loop condition to ensure all bytes in the buffer are checked.

  • Fixed the loop condition in wh_Utils_memeqzero to iterate over all bytes, including the first, by changing while (size > 1) to while (size > 0).

Copy link
Copy Markdown
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

This PR fixes an off-by-one error in wh_Utils_memeqzero() so it checks all bytes in the provided buffer (including buffer[0]), ensuring correct “all-zero” detection.

Changes:

  • Update the loop condition in wh_Utils_memeqzero() from while (size > 1) to while (size > 0) so the final byte (buffer[0]) is validated.

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

You can also share your feedback on Copilot code review. Take the survey.

@bigbrett bigbrett merged commit 0507f33 into main Mar 17, 2026
55 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