perl-unicode

unpack("%48U*",...) [PATCH 5.005_52]

1998-10-13 12:51:35
Another bug discovered:

$ perl -le 'print unpack("%48U*", "\x{FFFFFFFF}\1")'
0

...but this time with a patch.  After patching it prints:

$ perl -le 'print unpack("%48U*", "\x{FFFFFFFF}\1")'
4294967296

Regards,
Gisle


Index: pp.c
===================================================================
RCS file: /usr/home/aas/CVSROOT/perl_52/pp.c,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 pp.c
--- pp.c        1998/10/06 17:30:50     1.1.1.1
+++ pp.c        1998/10/13 19:32:33
@@ -3426,7 +3426,10 @@
                while (len-- > 0 && s < strend) {
                    auint = utf8_to_uv((U8*)s, &along);
                    s += along;
-                   culong += auint;
+                   if (checksum > 32)
+                       cdouble += (double)auint;
+                   else
+                       culong += auint;
                }
            }
            else {
@@ -3862,7 +3865,7 @@
        if (checksum) {
            sv = NEWSV(42, 0);
            if (strchr("fFdD", datumtype) ||
-             (checksum > 32 && strchr("iIlLN", datumtype)) ) {
+             (checksum > 32 && strchr("iIlLNU", datumtype)) ) {
                double trouble;
 
                adouble = 1.0;

<Prev in Thread] Current Thread [Next in Thread>
  • unpack("%48U*",...) [PATCH 5.005_52], Gisle Aas <=