Boost C++ Libraries: Ticket #4216: Uninitialized memory read in iostreams https://svn.boost.org/trac10/ticket/4216 <p> 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&lt;char&gt; 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. </p> <pre class="wiki">#include &lt;boost/iostreams/stream.hpp&gt; #include &lt;boost/iostreams/device/array.hpp&gt; #include &lt;boost/iostreams/filtering_streambuf.hpp&gt; #include &lt;boost/iostreams/copy.hpp&gt; #include &lt;boost/iostreams/filter/zlib.hpp&gt; #include &lt;vector&gt; int main() { using namespace boost::iostreams; std::vector&lt;char&gt; input_buffer(1024), output_buffer; stream&lt;array_source&gt; is(&amp;input_buffer[0], input_buffer.size()); filtering_streambuf&lt;output&gt; 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 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4216 Trac 1.4.3 José Gomes <jgomes@…> Fri, 14 May 2010 15:22:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4216#comment:1 https://svn.boost.org/trac10/ticket/4216#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Never mind, it is zlib: <a class="ext-link" href="http://www.zlib.net/zlib_faq.html#faq36"><span class="icon">​</span>http://www.zlib.net/zlib_faq.html#faq36</a> </p> Ticket