summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-03-05 18:03:23 -0700
committerKarl Williamson <khw@cpan.org>2022-03-05 21:04:39 -0700
commit286a1bfd696eb9d8dc1fa337234d1512f63beb67 (patch)
treeb57ee2c2909a3187fc1df75f68e2c611cdd1a90c /inline.h
parent3aea88f20c1f2a8df4a354a54cde01cd642750d9 (diff)
downloadperl-286a1bfd696eb9d8dc1fa337234d1512f63beb67.tar.gz
utf8_to_uvchr_buf_helper: Check before deref
*s may not be valid here; check first.
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 7ff7d799a2..c2123ad096 100644
--- a/inline.h
+++ b/inline.h
@@ -2532,7 +2532,7 @@ Perl_utf8_to_uvchr_buf_helper(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
}
else {
UV ret = utf8n_to_uvchr(s, send - s, retlen, 0);
- if (retlen && ret == 0 && *s != '\0') {
+ if (retlen && ret == 0 && (send <= s || *s != '\0')) {
*retlen = (STRLEN) -1;
}