b8876f
From 9604fbf0722bd97ca6031a263c50ad52b6633db7 Mon Sep 17 00:00:00 2001
b8876f
From: Tony Cook <tony@develop-help.com>
b8876f
Date: Wed, 14 Jun 2017 09:42:31 +1000
b8876f
Subject: [PATCH] (perl #131526) don't go beyond the end of the NUL in my_atof2
b8876f
MIME-Version: 1.0
b8876f
Content-Type: text/plain; charset=UTF-8
b8876f
Content-Transfer-Encoding: 8bit
b8876f
b8876f
Perl_my_atof2() calls GROK_NUMERIC_RADIX() to detect and skip past
b8876f
a decimal point and then can increment the parse pointer (s) before
b8876f
checking what it points at, so skipping the terminating NUL if the
b8876f
decimal point is immediately before the NUL.
b8876f
b8876f
Signed-off-by: Petr Písař <ppisar@redhat.com>
b8876f
---
b8876f
 numeric.c | 4 ++--
b8876f
 1 file changed, 2 insertions(+), 2 deletions(-)
b8876f
b8876f
diff --git a/numeric.c b/numeric.c
b8876f
index 6ea6968..5771907 100644
b8876f
--- a/numeric.c
b8876f
+++ b/numeric.c
b8876f
@@ -1485,9 +1485,9 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
b8876f
 	else if (!seen_dp && GROK_NUMERIC_RADIX(&s, send)) {
b8876f
 	    seen_dp = 1;
b8876f
 	    if (sig_digits > MAX_SIG_DIGITS) {
b8876f
-		do {
b8876f
+		while (isDIGIT(*s)) {
b8876f
 		    ++s;
b8876f
-		} while (isDIGIT(*s));
b8876f
+		}
b8876f
 		break;
b8876f
 	    }
b8876f
 	}
b8876f
-- 
b8876f
2.9.4
b8876f