diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-07 09:07:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-07 09:07:57 +0000 |
commit | 7017320f8bac809918117ffd4cf4f76e19fcf06c (patch) | |
tree | dee4fcfa5cf85dd9e9bd462a0569118fc114bf67 /string.c | |
parent | e8027cf078944af4b30070ff94c0d53db2428634 (diff) | |
download | ruby-7017320f8bac809918117ffd4cf4f76e19fcf06c.tar.gz |
string.c: fix integer overflow
* string.c (str_byte_substr): fix another integer overflow which
can happen only when SHARABLE_MIDDLE_SUBSTRING is enabled.
[ruby-core:79951] [Bug #13289]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -5254,7 +5254,7 @@ str_byte_substr(VALUE str, long beg, long len, int empty) beg += n; if (beg < 0) return Qnil; } - if (beg + len > n) + if (len > n - beg) len = n - beg; if (len <= 0) { if (!empty) return Qnil; |