You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Yuri Dario <mc...@mclink.it> on 2012/07/12 17:50:42 UTC

vcl field.cxx issue 150733 invalid float operation

Hi,

I finally discovered the cause of a strange crash on some pc for the 
os2 port. It is due to an invalid float operation in MetricField 
class. It seems that some CPU are processing some invalid float value,
which in turn generates the exception.

Surprisingly, the source code has this remark

sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 
mnBaseValue, sal_uInt16 nDecDigits,
                                     FieldUnit eInUnit, FieldUnit 
eOutUnit )
{
    // caution: precision loss in double cast
    return static_cast<sal_Int64>(
        // #150733# cast double to sal_Int64 can throw a
        // EXCEPTION_FLT_INVALID_OPERATION on Windows
        nonValueDoubleToValueDouble(
            ConvertDoubleValue( (double)nValue, mnBaseValue, 
nDecDigits,
                                eInUnit, eOutUnit ) ) );
}


but issue 150733 is not existing in current bugzilla database. I think
it is an internal staroffice/sun/oracle issue.

Do someone know how has it been resolved?

This bug is present when users show the page settings dialog to select
margins and page size. Since it happens when very big numbers are used
forI found a workaround using

    mnMax               = 0x00000000FFFFFFFFLL;

as initializer in void NumericFormatter::ImplInit()


thanks,

-- 
Bye,

	Yuri Dario

/*
 * OS/2 open source software
 * http://web.os2power.com/yuri
 * http://www.netlabs.org
*/



Re: vcl field.cxx issue 150733 invalid float operation

Posted by Yuri Dario <mc...@mclink.it>.
Hi Herbert,


> Does it help if you replace the call to that inline method isFinite() to 
> the macro SAL_MATH_FINITE()?

no, now code uses finite() but still crashes.

unfortunately debugger is unable to stop in the crashing line, so I 
don't know exactly which float op fails.

thanks!

-- 
Bye,

	Yuri Dario

/*
 * OS/2 open source software
 * http://web.os2power.com/yuri
 * http://www.netlabs.org
*/



Re: vcl field.cxx issue 150733 invalid float operation

Posted by Herbert Duerr <hd...@apache.org>.
Hi Yuri,

On 12.07.2012 17:50, Yuri Dario wrote:
> I finally discovered the cause of a strange crash on some pc for the
> os2 port. It is due to an invalid float operation in MetricField
> class. It seems that some CPU are processing some invalid float value,
> which in turn generates the exception.
> [...]
> but issue 150733 is not existing in current bugzilla database. I think
> it is an internal staroffice/sun/oracle issue.

Yes. Unfortunately that old database is gone for good.

> Do someone know how has it been resolved?

It has been resolved using the rtl::math::isFinite() check which in turn 
uses the SAL_MATH_FINITE macro which is interestingly defined in a 
platform-dependent way in main/sal/inc/sal/mathconf.h

What may be a problem is that the way the macro is defined for OS/2 it 
does not reliably work if it is called via the rtl::math::isFinite() 
function, because then the sizeof(type) magic fails.

Does it help if you replace the call to that inline method isFinite() to 
the macro SAL_MATH_FINITE()?

> This bug is present when users show the page settings dialog to select
> margins and page size. Since it happens when very big numbers are used
> forI found a workaround using
>
>      mnMax               = 0x00000000FFFFFFFFLL;
>
> as initializer in void NumericFormatter::ImplInit()

This sounds like a reasonable plan-B though I'm a bit worried to limit 
the value to 32bit because it was defined as 64bit for a reason.

Herbert

R: vcl field.cxx issue 150733 invalid float operation

Posted by Pedro Giffuni <pf...@apache.org>.
FWIW;

--- Gio 12/7/12, Yuri Dario ha scritto:

> Hi,
> 
> I finally discovered the cause of a strange crash on some pc
> for the os2 port. It is due to an invalid float operation in
> MetricField class. It seems that some CPU are processing
> some invalid float value, which in turn generates the
> exception.
>

Just for reference: we have an initial patch for this
issue that Yuri is testing.

cheers,

Pedro.

 
> Surprisingly, the source code has this remark
> 
> sal_Int64 MetricField::ConvertValue( sal_Int64 nValue,
> sal_Int64 
> mnBaseValue, sal_uInt16 nDecDigits,
>                
>                
>      FieldUnit eInUnit, FieldUnit 
> eOutUnit )
> {
>     // caution: precision loss in double cast
>     return static_cast<sal_Int64>(
>         // #150733# cast double to
> sal_Int64 can throw a
>         //
> EXCEPTION_FLT_INVALID_OPERATION on Windows
>         nonValueDoubleToValueDouble(
>            
> ConvertDoubleValue( (double)nValue, mnBaseValue, 
> nDecDigits,
>                
>                
> eInUnit, eOutUnit ) ) );
> }
> 
> 
> but issue 150733 is not existing in current bugzilla
> database. I think
> it is an internal staroffice/sun/oracle issue.
> 
> Do someone know how has it been resolved?
> 
> This bug is present when users show the page settings dialog
> to select
> margins and page size. Since it happens when very big
> numbers are used
> forI found a workaround using
> 
>     mnMax           
>    = 0x00000000FFFFFFFFLL;
> 
> as initializer in void NumericFormatter::ImplInit()
> 
> 
> thanks,
> 
> -- 
> Bye,
> 
>     Yuri Dario
> 
> /*
>  * OS/2 open source software
>  * http://web.os2power.com/yuri
>  * http://www.netlabs.org
> */
> 
> 
>