summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-05-16 13:15:56 -0600
committerKarl Williamson <khw@cpan.org>2021-05-29 06:04:10 -0600
commit0b47b39244b67fe19dc971903ce28a7a637c2a9a (patch)
tree380e57f81af386a4d5b20f6c4321a1ef9e67502b /utf8.h
parentfbfa0c9e6e0b2a3aa0ce844f02e82eb217cbddc6 (diff)
downloadperl-0b47b39244b67fe19dc971903ce28a7a637c2a9a.tar.gz
UTF8_IS_NEXT_CHAR_DOWNGRADEABLE() check before deref
Reorder the clauses to check first before dereferencing
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/utf8.h b/utf8.h
index 17d8b811d2..127ab832f3 100644
--- a/utf8.h
+++ b/utf8.h
@@ -474,8 +474,8 @@ uppercase/lowercase/titlecase/fold into.
/* This works in the face of malformed UTF-8. */
#define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) \
- ( UTF8_IS_DOWNGRADEABLE_START(*(s)) \
- && ( (e) - (s) > 1) \
+ ( ( (e) - (s) > 1) \
+ && UTF8_IS_DOWNGRADEABLE_START(*(s)) \
&& UTF8_IS_CONTINUATION(*((s)+1)))
/* Number of bytes a code point occupies in UTF-8. */