Skip to content
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

basic_value& operator= not guarding against self-assignment #192

Closed
agricartel opened this issue Jun 28, 2022 · 1 comment
Closed

basic_value& operator= not guarding against self-assignment #192

agricartel opened this issue Jun 28, 2022 · 1 comment

Comments

@agricartel
Copy link

In operator=(const basic_value& v) and operator=(basic_value&& v), if v is the same object as this (&v == this), a segmentation fault occurs (Tested on Ubuntu 20.04 with gcc 9.4.0) when invoking operator=.

To reproduce the issue:

toml::value tmp_tab{{"variable", "test"}};
tab_ = toml::value{{"table", tmp_tab}};
tab_["table"] = tab_["table"];
@ToruNiina
Copy link
Owner

Thank you for reporting! I reproduced the bug and added a quick patch.

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

No branches or pull requests

2 participants