Modify

Ticket #3822 (closed Bugs: fixed)

Opened 4 years ago

Last modified 4 years ago

boost/asio/buffer.hpp MSVC workaround is inaccurately targeted

Reported by: Stephan T. Lavavej <stl@…> Owned by: chris_kohlhoff
Milestone: Boost 1.42.0 Component: asio
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

This was reported to Microsoft as a bug in VC10 Beta 2 (see  http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=522096 ), but is actually a bug in Boost.Asio, caused by an inaccurately targeted workaround for a bug in VC8!

The offending code is in boost/asio/buffer.hpp :

~buffer_debug_check() {

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)

MSVC's string iterator checking may crash in a std::string::iterator object's destructor when the iterator points to an already-destroyed std::string object, unless the iterator is cleared first. iter_ = Iterator();

#endif BOOST_WORKAROUND(BOOST_MSVC, >= 1400)

}

The bug mentioned by the comment affected only VC8 (_MSC_VER == 1400). VC9 RTM and later are unaffected, as I fixed this bug in VC9 RTM. Therefore, the BOOST_WORKAROUND should check for == 1400, not >= 1400.

(This workaround uses a singular iterator as the source of an assignment, which triggers undefined behavior. This crashes VC10 Beta 2 due to the extensive changes we made in the STL. It should probably trigger an assert dialog - I've made a note to myself about that. But in any event, a conformant implementation is allowed to explode when it sees this. I believe the workaround is correct for VC8, and it appears to be harmless for VC9, but restricting it to VC8 would be ideal.)

Attachments

Change History

comment:1 Changed 4 years ago by chris_kohlhoff

This is related to ticket #3796.

comment:2 Changed 4 years ago by chris_kohlhoff

Changeset [58740] on trunk changes the test to _MSC_VER == 1400.

comment:3 Changed 4 years ago by chris_kohlhoff

  • Status changed from new to closed
  • Resolution set to fixed

(In [58883]) Merge from trunk. Fixes #3743, #3670, #3822.

........

r58670 | chris_kohlhoff | 2010-01-04 23:33:04 +1100 (Mon, 04 Jan 2010) | 2 lines

Fix example to compile with MSVC 10 beta 2.

........

r58671 | chris_kohlhoff | 2010-01-04 23:33:42 +1100 (Mon, 04 Jan 2010) | 2 lines

Fix Win64 warnings.

........

r58703 | chris_kohlhoff | 2010-01-05 22:51:41 +1100 (Tue, 05 Jan 2010) | 3 lines

Include boost/limits.hpp rather than <limits>, to support older compilers. Refs #3743.

........

r58704 | chris_kohlhoff | 2010-01-05 23:20:10 +1100 (Tue, 05 Jan 2010) | 2 lines

Drop back to second_clock if microsec_clock is unavailable. Refs #3743.

........

r58705 | chris_kohlhoff | 2010-01-05 23:50:39 +1100 (Tue, 05 Jan 2010) | 2 lines

Use sockatmark if SIOCATMARK is not defined. Refs #3743.

........

r58740 | chris_kohlhoff | 2010-01-06 13:38:39 +1100 (Wed, 06 Jan 2010) | 2 lines

Use buffer debugging workaround with MSVC 8 only.

........

r58761 | chris_kohlhoff | 2010-01-06 23:27:05 +1100 (Wed, 06 Jan 2010) | 2 lines

Disable iostreams-related functionality if BOOST_NO_IOSTREAMS is defined. Refs #3743.

........

r58762 | chris_kohlhoff | 2010-01-06 23:36:51 +1100 (Wed, 06 Jan 2010) | 2 lines

Apply fix for reported excessive CPU usage under Solaris. Refs #3670.

........

r58782 | chris_kohlhoff | 2010-01-07 09:44:48 +1100 (Thu, 07 Jan 2010) | 2 lines

Disable handler allocation and invocation hooks on g++ 2.x. Refs #3743.

........

r58793 | chris_kohlhoff | 2010-01-08 09:18:16 +1100 (Fri, 08 Jan 2010) | 2 lines

Support platforms that don't define INET6_ADDRSTRLEN. Refs #3743.

........

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.