From 971f885277110e1c10bb9b973af5c36aa5497d76 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Mon, 15 Oct 2018 11:01:24 +0000 Subject: [PATCH] Fix typos in code for alphabetic ranges in EBCDIC environments. --- ChangeLog | 4 ++++ src/pcre2_compile.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index dda5ab4..c4d472b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,10 @@ src/pcre2_chartables.c.dist are updated. 8. Implement the new Perl "script run" features (*script_run:...) and (*atomic_script_run:...) aka (*sr:...) and (*asr:...). +9. Fixed two typos in change 22 for 10.21, which added special handling for +ranges such as a-z in EBCDIC environments. The original code probably never +worked, though there were no bug reports. + Version 10.32 10-September-2018 ------------------------------- diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index e372eac..c4a515f 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -1937,9 +1937,9 @@ else c ^= 0x40; /* Handle \c in an EBCDIC environment. The special case \c? is converted to - 255 (0xff) or 95 (0x5f) if other character suggest we are using th POSIX-BC - encoding. (This is the way Perl indicates that it handles \c?.) The other - valid sequences correspond to a list of specific characters. */ + 255 (0xff) or 95 (0x5f) if other characters suggest we are using the + POSIX-BC encoding. (This is the way Perl indicates that it handles \c?.) + The other valid sequences correspond to a list of specific characters. */ #else if (c == CHAR_QUESTION_MARK) @@ -5710,10 +5710,10 @@ for (;; pptr++) if (range_is_literal && (cb->ctypes[c] & ctype_letter) != 0 && (cb->ctypes[d] & ctype_letter) != 0 && - (d <= CHAR_z) == (d <= CHAR_z)) + (c <= CHAR_z) == (d <= CHAR_z)) { uint32_t uc = (d <= CHAR_z)? 0 : 64; - uint32_t C = d - uc; + uint32_t C = c - uc; uint32_t D = d - uc; if (C <= CHAR_i)