[REVIEW][3-5] fdo#46923 possibly dodgy use of invalid iterators in sc inputhdl.cxx

Kohei Yoshida kohei.yoshida at gmail.com
Thu Mar 8 08:36:41 PST 2012


On Thu, Mar 8, 2012 at 11:14 AM, Caolán McNamara <caolanm at redhat.com> wrote:
> So, for https://bugs.freedesktop.org/show_bug.cgi?id=46923 under Linux
> with debugging stl iterators I can see "use of invalid iterator" stl
> errors with miAutoPosColumn which is a plausible reason for the reported
> crash.
>
> miAutoPosFormula is used to point into the std::set pFormulaData and
> miAutoPosColumn is used to point into the std::set pColumnData
>
> I reckon the safest thing to do is to initialize those to the end of
> their respective containers when the containers are initially allocated,
> i.e.
>
> http://cgit.freedesktop.org/libreoffice/core/commit/?id=a3f1614c606629196ca71dc22dab3343b060dced

Your fix looks good.  Thanks for catching it.  It was the result of me
switching from an integer based quasi iterators to the real STL
iterators.

But I did that refactoring for master only.  The 3.5 code has
something completely different (and even less safe); it uses a single
integer member nAutoPos to handle both formula and column positions.

So, I have my doubt that the invalid use of iterator you saw on master
applies to the 3.5 branch.

Kohei


More information about the LibreOffice mailing list