summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-11-24 10:54:23 -0700
committerKarl Williamson <khw@cpan.org>2016-11-24 11:07:33 -0700
commit3708669706516490ba9699d9d57d92d59fda1006 (patch)
treeca67f3c8d4b6ae8fb6b48668bec1c7f469ec0d99
parentb33122be550de502b2a2c0da46023b7ef4e00466 (diff)
downloadperl-3708669706516490ba9699d9d57d92d59fda1006.tar.gz
utf8.c: Fix EBCDIC detection of above-31 bit code points
This was failing on EBCDIC machines, and I couldn't figure out why. I didn't see any flaws in the logic. It required special debugging code to answer. It turns out it was a bad declaration, and not logic at all. The declaration should have been const U8 prefix[] = ... instead it was const U8 * const prefix = ... sizeof() the latter is 4, as it is looking at pointer size. What was intended was the size of the array this was initialized to, which was longer. What this led to was later in the routine, a comparison was stopping too early.
-rw-r--r--utf8.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/utf8.c b/utf8.c
index da575a9e4d..074f738806 100644
--- a/utf8.c
+++ b/utf8.c
@@ -383,8 +383,8 @@ S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * const e)
#ifdef EBCDIC
- /* [0] is start byte [1] [2] [3] [4] [5] [6] [7] */
- const U8 * const prefix = (U8 *) "\x41\x41\x41\x41\x41\x41\x42";
+ /* [0] is start byte [1] [2] [3] [4] [5] [6] [7] */
+ const U8 prefix[] = "\x41\x41\x41\x41\x41\x41\x42";
const STRLEN prefix_len = sizeof(prefix) - 1;
const STRLEN len = e - s;
const STRLEN cmp_len = MIN(prefix_len, len - 1);