[Boost-bugs] [Boost C++ Libraries] #4286: regex - making a pointer to an invalid dereferenced iterator.

Subject: [Boost-bugs] [Boost C++ Libraries] #4286: regex - making a pointer to an invalid dereferenced iterator.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-03 16:18:56


#4286: regex - making a pointer to an invalid dereferenced iterator.
-------------------------------------+--------------------------------------
 Reporter: CharlesPenny@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: regex
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 in function w32_transform in libs/regex/src/w32_regex_traits.cpp

 LCMapStringA() is called with parameter &*result.begin()

 In this case the std::string is created with std::string result(++bytes,
 '\0'), so I would have thought that *result.begin() would return
 result.end() as the length of the string is zero,
 even though a chunk of memory has been allocated.

 In my case, the iterator returns 0xccccccc and the subsequent
 LCMapStringA() call fails spectacularly in debug mode.

 I have _HAS_ITERATOR_DEBUGGING and _SECURE_SCL turned off.

 I switched to using &(result[0]) instead and that was fine.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4286>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC