Vector Serialization Bug in Boost 1.58

Bug #1583805 reported by Christopher R. Baker
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
boost (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Ubuntu Release: xenial
Source Package: boost1.58

While testing for a pending project upgrade to xenial, I encountered a problem with boost's serialization (specifically deserialization) of std::vector whereby repeatedly deserializing into a single instance of std::vector would accumulate entries in that vector instead of having them replaced.

Others have encountered this bug as well:

http://stackoverflow.com/questions/34042933/boost-vector-serialization-append-issue

According to boost's tracker, this bug is unique to version 1.58, and fixed at >= 1.59:

https://svn.boost.org/trac/boost/ticket/11612

After reviewing the diffs between 1.54 (previous working version from trusty), 1.58 (xenial target), and 1.60 (pulled from yakkety for examination), I believe this can be addressed by a one-line patch, which I have attached, reintroducing a call to vector::clear() at the appropriate juncture: I have attached that patch, which may be appended to the quilt series embedded in the current xenial source package for boost1.58, and have verified that, at least for all of my usages, this fixes the problem.

Given the reaction to the ticket ("Fixed in 1.59, invalid bug"), this seems to be an excellent candidate for inclusion as a bugfix/backport for xenial.

Let me know if there is anything else you need. I created the patch against the boost1.58 package sources with 'dpkg-source --commit', but I admit I deleted most of the "fill in this important information" because I did not yet have a launchpad bug, etc. to reference.

Tags: patch
Revision history for this message
Christopher R. Baker (tallbaker) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fixes the problem" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Christopher R. Baker (tallbaker) wrote :

The update that just went by (1.58.0+dfsg-5ubuntu3.1 from xenial-updates) forced me to re-patch vector.hpp, so I figured I would put a little bit more effort into a unit test that repeats the problem.

Revision history for this message
Christopher R. Baker (tallbaker) wrote :

simple makefile for the previous unit test

Revision history for this message
Christopher R. Baker (tallbaker) wrote :

If you run the unit test against the stock vector.hpp from 1.58.0+dfsg-5ubuntu3.1, you will see:

Running 2 test cases...
test_vector_serialize_assignment_semantics.cpp(74): fatal error in "test_vector_string": critical check test_origin.size() == test_deserialized.size() failed [3 != 6]

*** 1 failure detected in test suite "vector_serialize_assignment_semantics"

After the patch, you will see:

Running 2 test cases...

*** No errors detected

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in boost (Ubuntu):
status: New → Confirmed
Revision history for this message
ryan (rrcurtin) wrote :

This affects all downstream packages built against xenial that use boost::serialization to serialize vectors (which is a nonnegligible number of packages and includes one I help maintain). Can we therefore bump the priority on this please?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.