[Boost-bugs] [Boost C++ Libraries] #4216: Uninitialized memory read in iostreams

Subject: [Boost-bugs] [Boost C++ Libraries] #4216: Uninitialized memory read in iostreams
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-14 13:35:15


#4216: Uninitialized memory read in iostreams
------------------------------------------+---------------------------------
 Reporter: José Gomes <jgomes@…> | Owner: turkanis
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: iostreams
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
------------------------------------------+---------------------------------
 The code below, that compresses an array of characters, seems to work in
 general but valgrind reports several uninitialized memory reads.
 array_source is used to abstract the array of characters. This minimal
 reproduction uses a std::vector<char> to store the source data but the
 original application that this is reduced from does pass a char* and size
 as emulated here. This is using boost/1.36.0, boost/1.42.0, gcc/4.1.2,
 linux/2.6.18-53.

 {{{
 #include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/filtering_streambuf.hpp>
 #include <boost/iostreams/copy.hpp>
 #include <boost/iostreams/filter/zlib.hpp>
 #include <vector>

 int main()
 {
   using namespace boost::iostreams;
   std::vector<char> input_buffer(1024), output_buffer;
   stream<array_source> is(&input_buffer[0], input_buffer.size());
   filtering_streambuf<output> os;
   os.push(zlib_compressor());
   os.push(back_inserter(output_buffer));
   copy(is, os);
 }

 //g++ -g -Wall -I $BOOST_ROOT/include test_boos_zlib.cpp -L
 $BOOST_ROOT/lib -lboost_iostreams
 //valgrind ./a.out
 }}}

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