Skip to content

python: validate offset ranges before pointer arithmetic#610

Open
jmestwa-coder wants to merge 1 commit intogoogle:mainfrom
jmestwa-coder:python-offset-range-validation
Open

python: validate offset ranges before pointer arithmetic#610
jmestwa-coder wants to merge 1 commit intogoogle:mainfrom
jmestwa-coder:python-offset-range-validation

Conversation

@jmestwa-coder
Copy link
Copy Markdown

Summary

Add range validation in the Python conversion helpers before pointer arithmetic.

What changed

  • Validate inputs in CharLenToBytes() and BytesToCharLen() before creating derived pointers
  • Raise ValueError for invalid ranges
  • Add focused regression tests for invalid and valid boundary cases

Why

This makes invalid caller-supplied offsets fail predictably instead of reaching undefined behavior.

Testing

Added tests in python/re2_test.py for invalid offsets, boundary cases, and unchanged valid behavior.

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