From 76a798cf9449f8cc8edaf349ea2deb8ba7bd346a Mon Sep 17 00:00:00 2001 From: Franck Verrot Date: Thu, 23 Jul 2015 09:48:51 +0200 Subject: [PATCH] * string.c (chopped_length): early return for empty strings --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/string.c b/string.c index 5696057..592fb2c 100644 --- a/string.c +++ b/string.c @@ -7138,7 +7138,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') { -- 2.3.2 (Apple Git-55)