title: Code using boost::asio::streambuf causes segfault
body: <p>I've experienced problems using asio::streambuf and am hoping someone can tell me if I'm using the class incorrectly. When I run this example code it segfaults. Why?</p>
  
  <p>To make things more confusing, this code works on Windows (Visual Studio 2008), but does not work on Linux (with gcc 4.4.1).</p>
  
  <pre><code>#include &lt;boost/asio.hpp&gt;
  using namespace std;
  
  int main()
  {
          boost::asio::streambuf Stream;
  
          // Put 4 bytes into the streambuf...
          int SetValue = 0xaabbccdd;
          Stream.sputn(reinterpret_cast&lt;const char*&gt;(&amp;SetValue), sizeof(SetValue));
  
          // Consume 3 of the bytes...
          Stream.consume(3);
          cout &lt;&lt; Stream.size() &lt;&lt; endl; // should output 1
  
          // Get the last byte...
          char GetValue;
          // --------- The next line segfaults the program ----------
          Stream.sgetn(reinterpret_cast&lt;char*&gt;(&amp;GetValue), sizeof(GetValue));
          cout &lt;&lt; Stream.size() &lt;&lt; endl; // should output 0
  
          return 0;
  }
  </code></pre>