Skip to content

Commit c218be1

Browse files
committed
Accept \p{nv=-0}
Some platforms already ignore the minus sign. The Unicode standard says the minus sign should be ignored always. (But always doing so would cause it to not properly get the only negative numeric value character in Unicode; I have submitted a ticket to Unicode about this. Nevertheless, it is in keeping with the letter and spirit of the standard for the leading minus to be ignored for -0)
1 parent 65f7cab commit c218be1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

regcomp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24628,6 +24628,15 @@ S_parse_uniprop_string(pTHX_
2462824628
break;
2462924629
}
2463024630
}
24631+
24632+
/* Turn nv=-0 into nv=0. These should be equivalent, but vary by
24633+
* underling libc implementation. */
24634+
if ( i == name_len - 1
24635+
&& name[name_len-1] == '0'
24636+
&& lookup_name[j-1] == '-')
24637+
{
24638+
j--;
24639+
}
2463124640
}
2463224641
}
2463324642
else { /* No '=' */

t/lib/croak/regcomp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,3 @@ qr/(?<=(?<!x)x)\K/;
179179
qr/(?<!(?<!x)x)\K/;
180180
EXPECT
181181
OPTIONS nonfatal
182-
########
183-
# NAME numeric parsing buffer overflow in numeric.c
184-
0=~/\p{nV:-0}/
185-
EXPECT
186-
Can't find Unicode property definition "nV:-0" in regex; marked by <-- HERE in m/\p{nV:-0} <-- HERE / at - line 1.

t/re/re_tests

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,8 @@ AB\s+\x{100} AB \x{100}X y - -
20782078
(?<=(?<!yz)b)c aabcdef y $& c - # Nested lookbehind without early bailout
20792079
(?<=(?<!yz)b)c abcdef y $& c - # Nested lookbehind with early bailout
20802080

2081+
\p{nv=-0} \x{660} y $& \x{660}
2082+
20812083
# Keep these lines at the end of the file
20822084
# pat string y/n/etc expr expected-expr skip-reason comment
20832085
# vim: softtabstop=0 noexpandtab

0 commit comments

Comments
 (0)