serge1 / ELFIO

ELFIO - ELF (Executable and Linkable Format) reader and producer implemented as a header only C++ library

Home Page:http://serge1.github.io/ELFIO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explicit = Operator for elfio Segfault

foreverska opened this issue · comments

Correct me if I'm wrong but ELFIO::elfio seems to have an explicit = operator which does a shallow copy of pointers within the object. This causes a segfault on second deconstruction if you happen to use it.

It should probably be explicitly deleted, a deep copy implemented or a solution which can survive a shallow copy (thread safety + shared pointers).

Thank you for mentioning this. Indeed, the copy constructor and assignment operator are not supported.
I have added their deletion in commit 29114f6.

Please let me know your results.

I propose following Rule of Five to the end and define move ctor and assignment operator, at least with = default; syntax.

Hi @pavelkryukov, thank you for the advice. The move constructor and assignment are implemented in f591a3b.
Just to make sure - is this what you meant?

Yes, looks great.

Please reopen if you feel that the issue still persists