title: Heap block modified past requested size
body: <p><strong>Update :</strong> The error seems to be generated by this line: *line = color;</p>
  
  <p>I get the following error but I don't understand where it can come from:</p>
  
  <p>The error:</p>
  
  <blockquote>
    <p>HEAP[testQt.exe]: 
    Heap block at 0B444FE8 modified at 0B44C6B0 past requested size of 76c0</p>
  </blockquote>
  
  <p>The line that generates it: </p>
  
  <pre><code>return QPixmap::fromImage(qimage);
  </code></pre>
  
  <p>From: </p>
  
  <pre><code>QPixmap Interpolation::getData() {
      QPointF pt(0, 0);
      QRgb color;
      QImage qimage(m_width, m_height, QImage::Format_ARGB32);
      qimage.fill(Qt::transparent);
  
      for (int i(0); i &lt; m_height; ++i) {
          m_progress-&gt;setValue(m_width+i);
          QRgb *line = (QRgb *)qimage.scanLine(i);
          for (int j(0); j &lt; m_width; ++j) {
              pt.setX(j);
              pt.setY(i);
              line += 1;
              if (isInHull(pt)) {
                  color = colorScale(interp(&amp;pt));
                  *line = color; //If I remove this part the program won't crash
              }
          }
      }  
      return QPixmap::fromImage(qimage);
  }
  </code></pre>
  
  <p>If it helps: </p>
  
  <pre><code>QRgb Interpolation::colorScale(qreal value)
  {
      int cat;
      cat = qFloor(qreal(9)*(value-m_min)/(m_max-m_min));
  
      return m_couleurs[cat];
  }
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>m_couleurs[0] = qRgb(247, 252, 240);
  m_couleurs[1] = qRgb(224, 243, 219);
  m_couleurs[2] = qRgb(204, 235, 197);
  m_couleurs[3] = qRgb(168, 221, 181);
  m_couleurs[4] = qRgb(123, 204, 196);
  m_couleurs[5] = qRgb(78, 179, 211);
  m_couleurs[6] = qRgb(43, 140, 190);
  m_couleurs[7] = qRgb(8, 104, 172);
  m_couleurs[8] = qRgb(8, 64, 129);
  </code></pre>
  
  <p>Any lead would be appreciated.</p>
  
  <p>Edit: added the full function in case it helps.
  Edit2: made the code more clear and removed the useless parts.
  Edit3: updated the question.</p>