Modify

Opened 4 years ago

Closed 4 years ago

Last modified 8 months ago

#9092 closed Bugs (fixed)

Unique insertion with hint bug when inserting ordered non-unique sequence

Reported by: Ion Gaztañaga Owned by: Ion Gaztañaga
Milestone: Boost 1.55.0 Component: container
Version: Boost 1.54.0 Severity: Problem
Keywords: flat_tree insertion with hint Cc: benpope81@…

Description

As reported in http://permalink.gmane.org/gmane.comp.lib.boost.devel/243830, inserting an ordered non-unique sequence in flat_set provokes a crash. The problem lies in function

priv_insert_unique_prepare (const_iterator pos, const value_type& val, insert_commit_data &commit_data)

where an incorrect iterator is returned when the hint points to a one-past an equivalent element.

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

(In [85612]) Fixes #9092

comment:2 Changed 8 months ago by anonymous

Hello!

I got same problem in boost 1.48 and managed to write unit-test with fixed input sequence. Thought it would be good to put and adapt this unit-test in boost.

Code:

        TEST(BoostFlatSet, ShouldNotCrash_WithCopyAndInsert_OfOrderedNonUniqueSequence)
	{		
		std::vector<size_t> test_numbers = boost::assign::list_of(4)(6)(8)(11)(13)(18)(18)(24)(26)(28)(31)(33)(38);

		boost::container::flat_set<size_t> output; 
		EXPECT_NO_FATAL_FAILURE(boost::copy(test_numbers, std::inserter(output, output.end())));
	}

Thanks!

Roman Vlasov

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.