#1103 SWIG_AsVal_double bug strtod/errno

closed-fixed
perl (97)
5
2010-08-18
2010-08-03
Justin Vallon
No

Supposing MyMod::f(double) is wrapped, the following fails with OverflowError

perl -e 'use MyMod; use Errno; $! = Errno::ERANGE; MyMod::f("3.5")'

The problem is that strtod sets errno on error, but does not clear it, and there is no clear "bad" return code from strtod (zero, for example, could be the result of an underflow).

Attached patch clears errno=0 before calling strtod.

Discussion

  • Justin Vallon
    Justin Vallon
    2010-08-03

    patch SWIG_AsVal_double call to strtod

     
  • William Fulton
    William Fulton
    2010-08-18

    Patch applied for swig-2.0.1, thanks.

     
  • William Fulton
    William Fulton
    2010-08-18

    • status: open --> closed
     
  • William Fulton
    William Fulton
    2010-08-18

    • assigned_to: nobody --> wsfulton
    • status: closed --> closed-fixed