Opened 14 years ago

Closed 14 years ago

#2478 closed Bugs (invalid)

Invalid assert in boost::filesystem::path::iterator

Reported by: Raffi Enficiaud <raffi.enficiaud@…> Owned by: Beman Dawes
Milestone: Boost 1.38.0 Component: filesystem
Version: Boost 1.36.0 Severity: Problem
Keywords: Cc:

Description

The following code asserts (fs = boost::filesystem)

Code begin

fs::path p1("/tmp/unit/repertoire"), p2("/tmp/unit/repertoire/.");

fs::path::iterator it1 = p1.begin(), it1e = p1.end(), it2 = p2.begin(), it2e = p2.end();

for(; (*it1 == *it2) && (it2 != it2e) && (it1 != it1e); ++it1, ++it2) {}

p2 = "";

while(it2 != it2e) {

p2 /= *it2;

++it2; <- asserts on this line (first pass)

}

Code end

The assertion (DEBUG defined) is thrown on line 1342 inside file "boost/filesystem/path.hpp". Basically, the assert checks if the increment it outside of the range of iteration. However, after checking it2 != it2e, I should be able to increment it (but not the dereference it). Moreover, if it2 != it2e, I should be able to call ++it2.

The environnement is the following :

  • Windows XP (on virtual box)
  • Visual C++ express 2008 (version 9.0.21022.8 RTM)
  • Boost 1.37 (I think it is the same with 1.36)

Change History (3)

in reply to:  description comment:1 by Raffi Enficiaud <raffi.enficiaud@…>, 14 years ago

Sorry, I didn't notice I was erasing the container p2.

comment:2 by Marshall Clow, 14 years ago

Component: Nonefilesystem
Owner: set to Beman Dawes

comment:3 by Beman Dawes, 14 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.