Skip to content

Commit bb5e773

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 0eeecee commit bb5e773

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

regcomp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24679,6 +24679,15 @@ S_parse_uniprop_string(pTHX_
2467924679
break;
2468024680
}
2468124681
}
24682+
24683+
/* Turn nv=-0 into nv=0. These should be equivalent, but vary by
24684+
* underling libc implementation. */
24685+
if ( i == name_len - 1
24686+
&& name[name_len-1] == '0'
24687+
&& lookup_name[j-1] == '-')
24688+
{
24689+
j--;
24690+
}
2468224691
}
2468324692
}
2468424693
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,9 @@ AB\s+\x{100} AB \x{100}X y - -
21072107
/a?(*ACCEPT)b/ a y >$&< >a< - # Test minlen for ACCEPT
21082108
/a?(*ACCEPT)b/ b y >$&< >< - # Test minlen for ACCEPT
21092109
/ (A (*ACCEPT) | BC){2} D{0,4}/x A y $1 A - # ACCEPT optimizer check
2110+
2111+
\p{nv=-0} \x{660} y $& \x{660}
2112+
21102113
# Keep these lines at the end of the file
21112114
# pat string y/n/etc expr expected-expr skip-reason comment
21122115
# vim: softtabstop=0 noexpandtab

0 commit comments

Comments
 (0)