Opened 12 years ago

Closed 12 years ago

#4216 closed Bugs (wontfix)

Uninitialized memory read in iostreams

Reported by: José Gomes <jgomes@…> Owned by: Jonathan Turkanis
Milestone: Boost 1.43.0 Component: iostreams
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

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

Change History (1)

comment:1 by José Gomes <jgomes@…>, 12 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.