diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-07 07:39:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-07 07:39:47 +0000 |
commit | fb84b86be0f2758bacfb6d04c13e5946f4179fa4 (patch) | |
tree | fd0a8bf81afa4dc4fd05a5acf436260b4fceb4aa /string.c | |
parent | f27643e5eb464a6bd2c3b3ff3f2f7f165b14e1fb (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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') { |