Opened 16 years ago

Closed 16 years ago

#867 closed Bugs (Works For Me)

Usage of uninitialized data member

Reported by: nobody Owned by: Robert Ramey
Milestone: Component: serialization
Version: None Severity:
Keywords: Cc:

Description

In the attached test case, data member basic_iarchive_impl::moveable_objects_recent is used before being initialized.

More specifically, the first call to basic_iarchive_impl::reset_object_address occurs before the first assignment of basic_iarchive_impl::moveable_objects_recent takes place (in basic_iarchive_impl::load_object).

The usage of uninitialized data can be detected using a memory checker such as valgrind, or a debugging environment which sets uninitialized memory to distinctive values, such as Visual C++.

I found this problem in 1.33.1 but I had a look at the 1.34 code in cvs and it does not appear to be fixed.  

In a tentative fix I initialized moveable_objects_recent in the basic_iarchive_impl constructor (to zero). This seems to work but I am not sure it is the right solution.  

This problem still occurs if the extra "i++" in basic_iarchive_impl::reset_object_address present in 1.33.1 is taken out.

This bug seems to be triggered by serializing a map whose values contain vectors.

Change History (1)

comment:1 by Robert Ramey, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=396141
Originator: NO

I ran the test against the version in the HEAD and found no problems.  
Note: See TracTickets for help on using tickets.