SEGFAULT using boost::filesystem::recursive_directory_iterator
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
boost1.48 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When using the the increment(
it fails to report the end iterator which leads to a SEGFAULT when trying to access the path of the (actually defunct) iterator.
Test code:
#include <boost/
using namespace boost::filesystem;
using namespace boost::system;
int main(int argc, char* argv[]) {
if (argc != 2) return 1;
error_code ec;
for (recursive_
{
}
}
Compile with "g++ -g test.cpp -lboost_filesystem -lboost_system"
Run e.g. "gdb -ex run --args ./a.out /proc/$$"
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bcac11 in boost::
This bug was fixed upstream as part of SVN revision 76667 (http://
Here's a diff of the relevant part of that commit which fixes this problem:
--- operations.hpp.orig 2012-01-06 08:37:50.000000000 +0100
+++ operations.hpp 2013-06-06 11:08:58.223889240 +0200
@@ -782,6 +782,8 @@
+ if (m_imp-
+ m_imp.reset(); // done, so make end iterator
return *this;
}