Skip to content

Fix incorrect buffer size calculation in FromBytes to prevent data tr…#630

Open
uwezkhan wants to merge 1 commit intogoogle:mainfrom
uwezkhan:fix/buffer-size-calculation
Open

Fix incorrect buffer size calculation in FromBytes to prevent data tr…#630
uwezkhan wants to merge 1 commit intogoogle:mainfrom
uwezkhan:fix/buffer-size-calculation

Conversation

@uwezkhan
Copy link
Copy Markdown

@uwezkhan uwezkhan commented May 9, 2026

This PR fixes an incorrect buffer size calculation in the FromBytes helper function used to convert Python buffers into absl::string_view.

Previously, the code used the number of elements (bytes.size) as the total byte length, which is incorrect for buffers where itemsize is greater than 1. This could lead to truncated data and incorrect regex behavior.

The fix ensures the correct byte length is computed using bytes.size * bytes.itemsize.
Patch / Diff

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