Skip to content

PYTHON-6110 Bound Regex element scans to the remaining document bytes - #3109

Merged
aclark4life merged 1 commit into
mongodb:v4.18from
aclark4life:PYTHON-6110-v4.18
Oct 8, 2026
Merged

aclark4life merged 1 commit into
mongodb:v4.18from
aclark4life:PYTHON-6110-v4.18

Conversation

@aclark4life

@aclark4life aclark4life commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PYTHON-6110

Changes in this PR

Backport of 8fb5685 to v4.18, for the 4.18.3 release.

Test Plan

  • test_malformed_regex — an unterminated flags string must raise InvalidBSON
  • test_regex_empty_flags — a valid regex with empty flags must still decode

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

…nt bytes

Decoding a malformed Regex element could scan past the end of the
caller's buffer. The decoder now searches for each string's NUL within
the document instead of scanning the buffer, raising InvalidBSON on
malformed elements on every accepted buffer type.

(cherry picked from commit 8fb5685)
@aclark4life
aclark4life marked this pull request as ready for review October 8, 2026 18:41
@aclark4life
aclark4life requested a review from a team as a code owner October 8, 2026 18:41
@aclark4life aclark4life changed the title PYTHON-6110 [v4.18] Bound Regex element scans to the remaining document bytes PYTHON-6110 Bound Regex element scans to the remaining document bytes Oct 8, 2026
@aclark4life
aclark4life merged commit bb8d4e1 into mongodb:v4.18 Oct 8, 2026
33 of 34 checks passed
@aclark4life
aclark4life deleted the PYTHON-6110-v4.18 branch October 8, 2026 18:45
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