fix buggy treatment of large checksums on unicode strings
Gisle Aas [Tue, 13 Oct 1998 21:35:39 +0000 (23:35 +0200)]
Message-ID: <m31zocp850.fsf@furu.g.aas.no>
Subject: unpack("%48U*",...)  [PATCH 5.005_52]

p4raw-id: //depot/perl@1997

pp.c

diff --git a/pp.c b/pp.c
index 998cf93..9d9ad5c 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -3416,7 +3416,10 @@ PP(pp_unpack)
                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 {
@@ -3852,7 +3855,7 @@ PP(pp_unpack)
        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;