#3822 closed Bugs (fixed)
boost/asio/buffer.hpp MSVC workaround is inaccurately targeted
Reported by: | 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.)
Change History (3)
comment:1 by , 13 years ago
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(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.
........
This is related to ticket #3796.