Subject: [Boost-bugs] [Boost C++ Libraries] #10084: void_upcast should throw an unregistered_cast exception when it can't find a way to upcast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-31 14:11:42
#10084: void_upcast should throw an unregistered_cast exception when it can't find
a way to upcast
---------------------------------------------+---------------------------
Reporter: Steve Hickman <steve.hickman@â¦> | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.55.0 | Severity: Problem
Keywords: |
---------------------------------------------+---------------------------
It is possible for the void_caster_register to not include information on
how to upcast between types. In version 1.55,
void_upcast(lines 314-334) in void_cast.cpp searches the
void_caster_register for this information and, if it finds none, returns
NULL. If this happens when doing deserialization, it means that all of the
deserialized data is thrown away (event though it may have been
successfully completed) and the user gets a null pointer back instead. At
a minimum, this results in mysterious behavior when deserializing derived
classes through a base class pointer. At worst, this may result in a
memory leak (haven't investigated this). It seems to me that rather than
surprising the user like this, failures to find appropriate cast info in
the void_caster_register should cause an unregistered_cast exception (or
something similar) so the user will at least know where the problem is.
This can happen even though void_upcast the appropriate type information
for both the base and derived class.
This problem occurs when the void_caster_register is empty, which has
happened when both Boost.Serialize and the library of classes to be
serialized are created as DLLs on Windows 7 when building using VS2012.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10084> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC