Opened 5 years ago

Last modified 5 years ago

#13400 new Bugs

boost::archive::xml_iarchive Exception in destructor: "input stream error-No error"

Reported by: Andrei Bryleuski <andrey-brilevskiy@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.66.0 Severity: Problem
Keywords: Cc:

Description

The sample code:

#include <unordered_map> #include <boost/serialization/unordered_map.hpp> #include <boost/serialization/vector.hpp> #include <boost/serialization/nvp.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_iarchive.hpp> #include <fstream> #include <iostream>

std::ifstream ifs("commandKeyToAction.xml"); auto newCommandKeyToAction = std::unordered_map<std::string, std::unordered_map<std::string, std::vector<std::string>>>();

boost::archive::xml_iarchive xmlIn(ifs); xmlIn >> boost::serialization::make_nvp("options", newCommandKeyToAction);

Attachments (1)

commandKeyToAction.xml (3.2 KB ) - added by Andrei Bryleuski <andrey-brilevskiy@…> 5 years ago.
File to deserialize

Download all attachments as: .zip

Change History (5)

by Andrei Bryleuski <andrey-brilevskiy@…>, 5 years ago

Attachment: commandKeyToAction.xml added

File to deserialize

comment:1 by Andrei Bryleuski <andrey-brilevskiy@…>, 5 years ago

The exception occurs in: boost_1_66_0\boost\serialization\throw_exception.hpp

template<class E> inline void throw_exception(E const & e){

throw e;

}

comment:2 by Andrei Bryleuski <andrey-brilevskiy@…>, 5 years ago

Component: Noneserialization
Owner: set to Robert Ramey
Version: Boost 1.63.0Boost 1.66.0

comment:3 by frederic.devernay@…, 5 years ago

probably a duplicate of #13354

comment:4 by Frédéric Devernay <frederic.devernay@…>, 5 years ago

found the problem. This is actually not a bug in boost but a bug in the code that produced the xml: the </boost_serialization> tag is missing.

maybe you used a stringstream as in #13354, and forgot to destroy the xml_oarchive before getting the string? see comment 4 in issue #13354

Note: See TracTickets for help on using tickets.