summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-02-07 07:39:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-02-07 07:39:47 +0000
commitfb84b86be0f2758bacfb6d04c13e5946f4179fa4 (patch)
treefd0a8bf81afa4dc4fd05a5acf436260b4fceb4aa /string.c
parentf27643e5eb464a6bd2c3b3ff3f2f7f165b14e1fb (diff)
* string.c (chopped_length): early return for empty strings
[Bug #11391] From: Franck Verrot <franck@verrot.fr> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
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') {