summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-05-13 11:50:44 -0600
committerKarl Williamson <khw@cpan.org>2021-05-28 07:00:14 -0600
commit1e870beca985cb6a4dbf3d59bc34b4a36b7280b1 (patch)
tree99722bd71aefd584b5c9850e0c9a057624818198 /inline.h
parente5b416634d0055def68bf629b50aea1f831efda2 (diff)
downloadperl-1e870beca985cb6a4dbf3d59bc34b4a36b7280b1.tar.gz
isUTF8_CHAR() Check ptr before dereferencing
It is legal to call this function, though not so done in core, with empty input. By swapping two conditions in the same 'if', we check if empty before trying to access it.
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/inline.h b/inline.h
index bbf27da6f5..8ec66b2290 100644
--- a/inline.h
+++ b/inline.h
@@ -1140,7 +1140,7 @@ Perl_isUTF8_CHAR(const U8 * const s0, const U8 * const e)
#if defined(UV_IS_QUAD) || defined(EBCDIC)
- if (NATIVE_UTF8_TO_I8(*s0) == 0xFF && e - s0 >= UTF8_MAXBYTES) {
+ if (e - s0 >= UTF8_MAXBYTES && NATIVE_UTF8_TO_I8(*s0) == 0xFF) {
return is_utf8_char_helper(s0, e, 0);
}