Skip to content

Commit e56dfd9

Browse files
committed
handle s being updated without len being updated
fix #17279
1 parent 9e0c85b commit e56dfd9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ Perl_my_atof3(pTHX_ const char* orig, NV* value, const STRLEN len)
15601560
/* strtold() accepts 0x-prefixed hex and in POSIX implementations,
15611561
0b-prefixed binary numbers, which is backward incompatible
15621562
*/
1563-
if ((len == 0 || len >= 2) && *s == '0' &&
1563+
if ((len == 0 || len - (s-orig) >= 2) && *s == '0' &&
15641564
(isALPHA_FOLD_EQ(s[1], 'x') || isALPHA_FOLD_EQ(s[1], 'b'))) {
15651565
*value = 0;
15661566
return (char *)s+1;

t/lib/croak/regcomp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ EXPECT
7979
$x =~ /(?<=a\Ka)a/;
8080
EXPECT
8181
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<=a\K <-- HERE a)a/ at - line 1.
82+
########
83+
# NAME numeric parsing buffer overflow in numeric.c
84+
0=~/\p{nV:-0}/
85+
EXPECT
86+
Can't find Unicode property definition "nV:-0" in regex; marked by <-- HERE in m/\p{nV:-0} <-- HERE / at - line 1.

0 commit comments

Comments
 (0)