diff --git a/numeric.c b/numeric.c index f5fc1f634a98..2b880376bda4 100644 --- a/numeric.c +++ b/numeric.c @@ -1560,7 +1560,7 @@ Perl_my_atof3(pTHX_ const char* orig, NV* value, const STRLEN len) /* strtold() accepts 0x-prefixed hex and in POSIX implementations, 0b-prefixed binary numbers, which is backward incompatible */ - if ((len == 0 || len >= 2) && *s == '0' && + if ((len == 0 || len - (s-orig) >= 2) && *s == '0' && (isALPHA_FOLD_EQ(s[1], 'x') || isALPHA_FOLD_EQ(s[1], 'b'))) { *value = 0; return (char *)s+1; diff --git a/t/lib/croak/regcomp b/t/lib/croak/regcomp index fc410829b606..201fb9467e8b 100644 --- a/t/lib/croak/regcomp +++ b/t/lib/croak/regcomp @@ -79,3 +79,8 @@ EXPECT $x =~ /(?<=a\Ka)a/; EXPECT \K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<=a\K <-- HERE a)a/ at - line 1. +######## +# NAME numeric parsing buffer overflow in numeric.c +0=~/\p{nV:-0}/ +EXPECT +Can't find Unicode property definition "nV:-0" in regex; marked by <-- HERE in m/\p{nV:-0} <-- HERE / at - line 1.