[Boost-bugs] [Boost C++ Libraries] #4640: Fixed-sized array constructor can have unintended consequences

Subject: [Boost-bugs] [Boost C++ Libraries] #4640: Fixed-sized array constructor can have unintended consequences
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-09-09 18:25:22


#4640: Fixed-sized array constructor can have unintended consequences
------------------------------------------+---------------------------------
 Reporter: boost@… | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: fixed size array constructor |
------------------------------------------+---------------------------------
 As initially reported here:
 http://article.gmane.org/gmane.comp.lib.boost.devel/208444

 The fixed-size array constructor takes the whole array, not accounting for
 possible null-terminators in the array.

 Here is a more obvious test case that shows the problem:

 {{{
 void
 array_ctor_test()
 {
     char buf[256];
     strcpy(buf, "mydir/mysubdir");

     bfs::path p1(buf);
     bfs::path p2(&buf[0]);
     assert(p1 == p2); // Passes, because char-compares up to null

     p1 /= "extra";
     p2 /= "extra";
     assert(p1 == p2); // fail
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4640>
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