Opened 10 years ago

#6834 new Bugs

Memory corruption when calling boost::filesystem::exists() from static initializer with Unicode paths

Reported by: memger@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.49.0 Severity: Problem
Keywords: filesystem access violation exists Cc:

Description

Assume we have a class MyClass with the constructor as shown below. Now, if we create a static instance of MyClass (or have some other mechanism to execute this code at static initialization time), then this code will create an access violation exception when exists() is called.

MyClass::MyClass() {
	boost::filesystem::path path(L"C:\\Windows");
	path /= boost::filesystem::path(L"notepad.exe");
	if (!boost::filesystem::exists(path)) {
		std::cout << "notepad.exe doesn't exist!" << std::endl;
	}
}

The code was tested on Windows 7 X64 SP1 with VS 2008 SP1 with boost 1.49.

Change History (0)

Note: See TracTickets for help on using tickets.