Skip to content

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

@agricartel

Description

@agricartel

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"];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions