Pb with Boost and VC++7.1 : inconsistent code ?
Hello everyone.
I'm new to this mailing-list but I have a very annoying and urgent problem
concerning Boost and the STL.
I just upgraded to Boost 1.33.1 which is needed for the new version of
libtorrent, linked statically in one of my DLLs.
Build of Boost went quite well (using BJam)
Build of lib went OK.
Build of DLL : no problem either.
But then at runtime I get this :
Unhandled exception at 0x77e79282 in TestFileDl.exe: Microsoft C++
exception: boost::filesystem::filesystem_error @ 0x0012d654.
Exception thrown in [path_posix_windows.cpp] line 339 :
if ( !checker( name ) )
{
boost::throw_exception( filesystem_error(
"boost::filesystem::path",
"invalid name \"" + name + "\" in path: \"" + src +
"\"" ) );
}
... because this check does not behave properly :
BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name )
{
return name.size() != 0
&& name.find_first_of( windows_invalid_chars ) == std::string::npos
<-------------- (here)
&& *(name.end()-1) != ' '
&& (*(name.end()-1) != '.'
|| name.length() == 1 || name == "..");
}
... because find_first_of does not return what it should, in [xstring] :
size_type find_first_of(const _Elem *_Ptr,
size_type _Off, size_type _Count) const
{ // look for one of [_Ptr, _Ptr + _Count) at or after _Off
if (0 < _Count && _Off < _Mysize)
{ // room for match, look for it
const _Elem *const _Vptr = _Myptr() + _Mysize;
for (const _Elem *_Uptr = _Myptr() + _Off; _Uptr < _Vptr;
++_Uptr)
if (_Traits::find(_Ptr, _Count, *_Uptr) != 0)
return (_Uptr - _Myptr()); // found a match
}
return (npos); // no match
}
Obviously the std::string is screwed up here, because I think _Mysize should
not be 31, which makes the [for] searche outside the boudaries of the
buffer, thus returning the wrong results...
+ this 0x0012d854 {"main_session.log"} const
std::basic_string
Have you changed the filename validator in boost filesystem? It might
be bugging on an unexpected char.
On 9/15/06, Washburn
Hello everyone. I'm new to this mailing-list but I have a very annoying and urgent problem concerning Boost and the STL.
I just upgraded to Boost 1.33.1 which is needed for the new version of libtorrent, linked statically in one of my DLLs. Build of Boost went quite well (using BJam) Build of lib went OK. Build of DLL : no problem either.
But then at runtime I get this :
Unhandled exception at 0x77e79282 in TestFileDl.exe: Microsoft C++ exception: boost::filesystem::filesystem_error @ 0x0012d654.
Exception thrown in [path_posix_windows.cpp] line 339 :
if ( !checker( name ) ) { boost::throw_exception( filesystem_error( "boost::filesystem::path", "invalid name \"" + name + "\" in path: \"" + src + "\"" ) ); }
... because this check does not behave properly :
BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ) { return name.size() != 0 && name.find_first_of( windows_invalid_chars ) == std::string::npos <-------------- (here) && *(name.end()-1) != ' ' && (*(name.end()-1) != '.' || name.length() == 1 || name == ".."); }
... because find_first_of does not return what it should, in [xstring] :
size_type find_first_of(const _Elem *_Ptr, size_type _Off, size_type _Count) const { // look for one of [_Ptr, _Ptr + _Count) at or after _Off if (0 < _Count && _Off < _Mysize) { // room for match, look for it const _Elem *const _Vptr = _Myptr() + _Mysize; for (const _Elem *_Uptr = _Myptr() + _Off; _Uptr < _Vptr; ++_Uptr) if (_Traits::find(_Ptr, _Count, *_Uptr) != 0) return (_Uptr - _Myptr()); // found a match } return (npos); // no match }
Obviously the std::string is screwed up here, because I think _Mysize should not be 31, which makes the [for] searche outside the boudaries of the buffer, thus returning the wrong results...
+ this 0x0012d854 {"main_session.log"} const std::basic_string
* const _Mysize 31 unsigned int I also believe that the symbol table is wrong here but I'm not sure. This piece of code belongs to the libtorrent project and is supposed to be stable.
Then it gets even worse : after the acual throwing of the exception (the "throw" instruction), my call stack is screwed with a call to feeefeee()...
I tried all compilation and link options, getting always the same result. Any idea people ? Please help :(
Washburn
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Cory Nelson http://www.int64.org
Hello everyone. I'm new to this mailing-list but I have a very annoying and urgent problem concerning Boost and the STL. Always a good idea to place the library name in the subject line, so
"Washburn"
participants (3)
-
Cory Nelson
-
David Abrahams
-
Washburn