Bug #2528
Exception during Factory construction can lead to corrupt object
Status: | Resolved | Start date: | 04/12/2016 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | J. Moringen | % Done: | 100% | |
Category: | C++ | |||
Target version: | rsb-0.14 |
Associated revisions
Reset factoryWhileLoadingPlugins in src/rsb/Factory.cpp
The Factory constructor could be unwound by an exception thrown by the
plugin system, leaving factoryWhileLoadingPlugins pointing to a
half-initialized Factory object. To prevent this, reset
factoryWhileLoadingPlugins to NULL in case an exception is thrown by the
plugin system, then re-throw.
Unfortunately, I cannot come up with a reasonable test for this. The
error would be easy to trigger by doing
setenv("RSB_PLUGINS_CPP_LOAD", "foo", 1);
try { Factory f; } catch (...) {};
Factory f => segmentation fault
but that would require making the Factory constructor public or some
equally ugly friend hackery. sigh
- src/rsb/Factory.cpp (header): updated copyright
(Factory::Factory): reset factoryWhileLoadingPlugins in case an
exception is thrown
History
#1 Updated by J. Moringen almost 7 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset rsb-cpp|a2b0dfa42627138ccbf3eaddeba073b1706505c2.