title: "munmap_chunk(): invalid pointer" with algorithms on vectors
body: <p>Next code crushed with <strong>munmap_chunk(): invalid pointer</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  using namespace std;
  
  vector&lt;int&gt; modules = {3,5,7};
  vector&lt;int&gt; remainders = {2,3,2};
  vector&lt;int&gt; m_bigs(modules.size());
  
  int main() {
      int m_big = 1;
      for(int r : remainders) { m_big *= r; };
      transform(m_bigs.begin(), m_bigs.end(), remainders.begin(), remainders.end(), [m_big](int m, int r){ cout &lt;&lt; m_big / r &lt;&lt; endl; return m_big / r; });
      for(int m : m_bigs) { cout &lt;&lt; m &lt;&lt; endl; };
  
      return 0;
  }
  </code></pre>
  
  <p>the output is </p>
  
  <p>6
  4
  6
  4
  6
  0</p>
  
  <p>but expected is</p>
  
  <p>6
  4
  6
  6
  4
  6</p>