[Libreoffice] [PATCH] fix for crash in math.cxx for std::numeric_limits<int>::min

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Dec 13 01:16:24 PST 2011


Hello Kohei,


>
> I would be interested to know how to reproduce this crash.  Do you have
> a good way to reproduce this?
>

Try fdo#43703 in master. This bug shows two problems. Firstly the
problem in math.cxx and secondly as already done with
http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-3-5&id=8216e8551dad8a3bbedb4b8e663b2d96570270a0
to handle infinite values correctly.

>> Any objections against this patch? I think that this fix should be
>> correct for all cases but it would be good if someone could have a
>> look at it.
>
> Well, I'm not necessarily objecting, but I'm a bit puzzled.  I would've
> thought that, if nExp < 0 is true, -nExp > 0 is automatically true.
> Anyway, if you have a code snippet that can make this code to segfault,
> that would help me understand this better.
>

As described by Lionel this is true for all integers except for
numeric_limits<int>::min(). It is a really strange corner case but as
we see with the mentioned bug report we may get it from time to time
and I can not gurantee that this was the only place where we could
have called this method with this number. I will add a comment as
Stephan suggested.

Markus


More information about the LibreOffice mailing list