Skip to content

Commit 1e870be

Browse files
committed
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.
1 parent e5b4166 commit 1e870be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ Perl_isUTF8_CHAR(const U8 * const s0, const U8 * const e)
11401140

11411141
#if defined(UV_IS_QUAD) || defined(EBCDIC)
11421142

1143-
if (NATIVE_UTF8_TO_I8(*s0) == 0xFF && e - s0 >= UTF8_MAXBYTES) {
1143+
if (e - s0 >= UTF8_MAXBYTES && NATIVE_UTF8_TO_I8(*s0) == 0xFF) {
11441144
return is_utf8_char_helper(s0, e, 0);
11451145
}
11461146

0 commit comments

Comments
 (0)