Skip to content

re2: guard against self-move-assignment in Set and FilteredRE2#616

Open
MarkLee131 wants to merge 1 commit intogoogle:mainfrom
MarkLee131:fix/self-move-assignment
Open

re2: guard against self-move-assignment in Set and FilteredRE2#616
MarkLee131 wants to merge 1 commit intogoogle:mainfrom
MarkLee131:fix/self-move-assignment

Conversation

@MarkLee131
Copy link
Copy Markdown

Fix #615:
The move assignment operators for RE2::Set and FilteredRE2 use a destroy-then-placement-new pattern. This is unsafe when this == &other because the destructor frees resources that the move constructor then tries to read from.

Add a self-assignment check to both operators.

The move assignment operators for RE2::Set and FilteredRE2 use a
destroy-then-placement-new pattern. This is unsafe when this == &other
because the destructor frees resources that the move constructor then
tries to read from.

Add a self-assignment check to both operators.
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.

Bug: Self-move-assignment in RE2::Set and FilteredRE2 causes use-after-destroy

1 participant