Opened 12 years ago
Closed 12 years ago
#4826 closed Bugs (invalid)
filesystem::path::operator/=(const value_type* next_p)
Reported by: | anonymous | Owned by: | Beman Dawes |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.36.0 | Severity: | Problem |
Keywords: | filesystem path operator/= | Cc: |
Description
It might be nice if the code checked if next_p+1 and next_p+2 existed before accessing them. The code in the iterator pair constructor immediately below does make the checks yet that seems to have failed to get into path::operator/=(const value_type* next_p)
reported on 1.36 exists 1.44 filesystem/V2
template<class String, class Traits> basic_path<String, Traits>& basic_path<String, Traits>::operator/=(const value_type* next_p ){
size_t len = typename String::traits_type::length(next_p); if(len!=0){
if(len>=3){
if ( *next_p == slash<path_type>::value
&& *(next_p+1) == slash<path_type>::value && *(next_p+2) == colon<path_type>::value ) {
next_p += 3;
}
}
append slash<path_type>::value if needed if ( !empty()
&& *next_p != 0 && !detail::is_separator<path_type>( *next_p ) ){
m_append_separator_if_needed();
}
for ( ; *next_p != 0; ++next_p ){
m_append( *next_p );
}
} return *this;
}
OR EVEN
template<class String, class Traits> basic_path<String, Traits>& basic_path<String, Traits>::operator/=(const value_type* next_p ){
size_t len = typename String::traits_type::length(next_p); if (len) operator/=(next_p,next_p+len); return *this;
}
please ignore - user error