Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Wed, Feb 08, 2012 at 09:56:09PM +0100, Stephan Bergmann wrote:

Lionel, can you please have a look whether 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=23151ab53574e0e893f4507313ff15388638746a>
"Tentative fix for invalid iterator range regression" is actually
good?

On Wed, Feb 08, 2012 at 09:08:20PM +0000, Caolán McNamara wrote:
since 37b5dce665a03d3404e6a710b82bef16d740d178
I've a crash in ::std::rotate(m_pMatrix->begin(), aEnd, aNewEnd); in the
smoketest (make dev-install)

I'm terribly sorry; I fixed it in my build and then... I forgot to
push :-(

I reverted Stephan's tentative fix, which was papering over the deeper
issue (see below).

ORowSetMatrix::iterator aEnd (m_pMatrix->begin() + nOverlapSize);
ORowSetMatrix::iterator aNewEnd (aEnd + nStartPosOffset);

I've got a negative nStartPosOffset

Yes, that's exactly the problem. The definition of nStartPosOffset was
inverted:

if ( nNewStartPos < m_nStartPos )
{   // need to fill data *before* m_nStartPos
  if ( nNewEndPos > m_nStartPos )
  {   // The two regions are overlapping.
     (...)
     const sal_Int32 nStartPosOffset = nNewStartPos - m_nStartPos; // by how much m_nStartPos moves
     (...)
  }
}

As the first if condition clearly shows, the positive value is
m_nStartPos - nNewStartPos, not the opposite.

so std::rotate's middle is after its end. Not entirely sure what
we're aiming for here, so I decided to leave it until tomorrow :-)

-- 
Lionel

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.