basic_value& operator= not guarding against self-assignment
agricartel opened this issue · comments
Craig commented
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"];
Toru Niina commented
Thank you for reporting! I reproduced the bug and added a quick patch.