From: Gisle Aas <gisle@aas.no>
Date: Tue, 13 Oct 1998 21:35:39 +0000 (+0200)
Subject: fix buggy treatment of large checksums on unicode strings
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=32d8b6e578ec44eac9ae5b98b03f265909d36357;p=p5sagit%2Fp5-mst-13.2.git

fix buggy treatment of large checksums on unicode strings
	Message-ID: <m31zocp850.fsf@furu.g.aas.no>
	Subject: unpack("%48U*",...)  [PATCH 5.005_52]

p4raw-id: //depot/perl@1997
---

diff --git a/pp.c b/pp.c
index 998cf93..9d9ad5c 100644
--- 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;