-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible data corruption when assigning variant to itself #164
Comments
/cc @artemp |
@SergeyIvanov87 - It looks like you're correct but I vaguely recall having some reasons for not having a check. I'll need to dig through history to see why implementation ended up like this and if we need to fix it. Thanks! |
This struck me as well. i'm upgrading it from "possible" to "definite". |
@SergeyIvanov87 @mgambrell @springmeyer - I don't remember why there's no check for the self assignment. I can only think that at some point operaror= signature was : VARIANT_INLINE variant<Types...>& operator=(variant<Types...> other) // <--- pass by value I'll take a look at adding the test tomorrow, thanks! |
Hi, Thanks to you variant implementation!
But i see, that there are issue in member
Now there are no check for
&other ==this
andcopy_assign
can destroy variant member data's before actual copy to itselfSo, in result
helper_type::copy(rhs.type_index, &rhs.data, &data);
can operate with invalid dataBest Regards
The text was updated successfully, but these errors were encountered: