From 0cc31f4df460bf4216abdcaadcc1b0dca0d4ab88 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 26 May 2019 12:22:26 -0600 Subject: [PATCH] regcomp.c: Fix -Dr bug If dumping the program and a single range crosses the border between being in the bitmap and not, the range must be split at the border because the output has separate text for things in the bitmap vs. those not. I'm not sure that there is a situation where this currently occurs, but it will so with a future commit --- regcomp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/regcomp.c b/regcomp.c index d515d1c..b389f9e 100644 --- a/regcomp.c +++ b/regcomp.c @@ -21520,9 +21520,14 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) /* As a final resort, output the range or subrange as hex. */ - this_end = (end < NUM_ANYOF_CODE_POINTS) - ? end - : NUM_ANYOF_CODE_POINTS - 1; + if (start >= NUM_ANYOF_CODE_POINTS) { + this_end = end; + } + else { + this_end = (end < NUM_ANYOF_CODE_POINTS) + ? end + : NUM_ANYOF_CODE_POINTS - 1; + } #if NUM_ANYOF_CODE_POINTS > 256 format = (this_end < 256) ? "\\x%02" UVXf "-\\x%02" UVXf -- 1.8.3.1