This addresses an assertion failure with make check and unicode-internal
APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1523351678 -3600
# Tue Apr 10 10:14:38 2018 +0100
# Node ID b2979b81a38663cd670146fe85967107dbe9d1eb
# Parent f101d3bd2814d0d11a2ff4ea21f7b80790d508fb
Be more careful about non-Ichar values in fastmaps, regex.c
src/ChangeLog addition:
2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
* regex.c (compile_char_class):
Use CHAR_CODE_LIMIT instead of MOST_POSITIVE_FIXNUM as the upper
bound for characters in the PRINT, GRAPH, NONASCII classes.
* regex.c (re_compile_fastmap):
Don't attempt to set_itext_ichar() with a non-character value
under Unicode internal.
diff -r f101d3bd2814 -r b2979b81a386 src/ChangeLog
--- a/src/ChangeLog Tue Apr 10 08:03:42 2018 +0100
+++ b/src/ChangeLog Tue Apr 10 10:14:38 2018 +0100
@@ -1,3 +1,12 @@
+2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * regex.c (compile_char_class):
+ Use CHAR_CODE_LIMIT instead of MOST_POSITIVE_FIXNUM as the upper
+ bound for characters in the PRINT, GRAPH, NONASCII classes.
+ * regex.c (re_compile_fastmap):
+ Don't attempt to set_itext_ichar() with a non-character value
+ under Unicode internal.
+
2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
* fileio.c (lisp_to_off_t): New function.
diff -r f101d3bd2814 -r b2979b81a386 src/regex.c
--- a/src/regex.c Tue Apr 10 08:03:42 2018 +0100
+++ b/src/regex.c Tue Apr 10 10:14:38 2018 +0100
@@ -4191,17 +4191,17 @@
case RECC_PRINT:
put_range_table (rtab, ' ', 0x7e, Qt);
- put_range_table (rtab, 0x80, MOST_POSITIVE_FIXNUM, Qt);
+ put_range_table (rtab, 0x80, CHAR_CODE_LIMIT, Qt);
break;
case RECC_GRAPH:
put_range_table (rtab, '!', 0x7e, Qt);
- put_range_table (rtab, 0x80, MOST_POSITIVE_FIXNUM, Qt);
+ put_range_table (rtab, 0x80, CHAR_CODE_LIMIT, Qt);
break;
case RECC_NONASCII:
case RECC_MULTIBYTE:
- put_range_table (rtab, 0x80, MOST_POSITIVE_FIXNUM, Qt);
+ put_range_table (rtab, 0x80, CHAR_CODE_LIMIT, Qt);
break;
case RECC_CNTRL:
@@ -4401,7 +4401,7 @@
set_itext_ichar (strr, last);
fastmap[*strr] = 1;
}
- else if (MOST_POSITIVE_FIXNUM == last)
+ else if (CHAR_CODE_LIMIT == last)
{
/* This is RECC_MULTIBYTE or RECC_NONASCII; true for all
non-ASCII characters. */
@@ -4422,7 +4422,7 @@
{
Ibyte strrlast[MAX_ICHAR_LEN];
set_itext_ichar (strr, first);
- set_itext_ichar (strrlast, last);
+ set_itext_ichar (strrlast, min (last, CHAR_CODE_LIMIT - 1));
for (jj = *strr; jj <= *strrlast; jj++)
fastmap[jj] = 1;
}
@@ -4546,7 +4546,10 @@
else
{
Ibyte strr[MAX_ICHAR_LEN];
- Bytecount slen = set_itext_ichar (strr, last);
+ Bytecount slen
+ = set_itext_ichar (strr,
+ min (last,
+ CHAR_CODE_LIMIT - 1));
int kk;
/* Same as above but for the last character using
our leading byte. */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)