Bug#644659: libmath-bigint-gmp-perl: new() from UV wrong value

Kevin Ryde user42 at zip.com.au
Fri Oct 7 21:20:55 UTC 2011


Package: libmath-bigint-gmp-perl
Version: 1.37-1
Severity: normal

The program foo.pl below prints

    18446744073709551615
    -

where I expected it to print

    18446744073709551615
    18446744073709551615

which is what you get from the plain Math::BigInt.

Nosing around Math::BigInt::GMP::_new() it looks like 

    if (SvUOK(x))
      {
      mpz_init_set_si(*RETVAL, (UV)SvUV(x));

doesn't take into account that a UV may be bigger than a long in a perl
64-bit bloat build such as debian's 5.12.  Maybe (untested)

    sizeof(UV) <= sizeof(unsigned long)

or similar added to the condition.  I expect it should be set_ui() not
set_si() anyway too.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.pl
Type: text/x-perl
Size: 103 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20111008/0156f112/attachment.pl>
-------------- next part --------------


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-486
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages libmath-bigint-gmp-perl depends on:
ii  libc6                               2.13-10       
ii  libgmp10                            2:5.0.2+dfsg-1
ii  libmath-bigint-perl                 1.997-1       
ii  perl                                5.12.4-5      
ii  perl-base [perlapi-5.12.4]          5.12.4-5      
ii  perl-modules [libmath-bigint-perl]  5.12.4-5      

libmath-bigint-gmp-perl recommends no packages.

libmath-bigint-gmp-perl suggests no packages.

-- no debconf information


More information about the pkg-perl-maintainers mailing list