[Boost-bugs] [Boost C++ Libraries] #4826: filesystem::path::operator/=(const value_type* next_p)

Subject: [Boost-bugs] [Boost C++ Libraries] #4826: filesystem::path::operator/=(const value_type* next_p)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-09 00:12:31


#4826: filesystem::path::operator/=(const value_type* next_p)
----------------------------------------+-----------------------------------
 Reporter: anonymous | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.36.0 | Severity: Problem
 Keywords: filesystem path operator/= |
----------------------------------------+-----------------------------------
 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;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4826>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC