From fb84b86be0f2758bacfb6d04c13e5946f4179fa4 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 7 Feb 2019 07:39:47 +0000 Subject: * string.c (chopped_length): early return for empty strings [Bug #11391] From: Franck Verrot git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 5110f45baa..88686db76d 100644 --- a/string.c +++ b/string.c @@ -8547,7 +8547,7 @@ chopped_length(VALUE str) beg = RSTRING_PTR(str); end = beg + RSTRING_LEN(str); - if (beg > end) return 0; + if (beg >= end) return 0; p = rb_enc_prev_char(beg, end, end, enc); if (!p) return 0; if (p > beg && rb_enc_ascget(p, end, 0, enc) == '\n') { -- cgit v1.2.3