diff options
author | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-20 06:53:45 +0000 |
---|---|---|
committer | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-20 06:53:45 +0000 |
commit | c44f11b5dd78537740b200506d5329317f490f47 (patch) | |
tree | e9b21a6a6302b1780cf1f9bd831cbf6227a9c7b3 | |
parent | 3d2a71470341f76fc3bf5c3fc930e9d1b5867b0e (diff) | |
download | ruby-c44f11b5dd78537740b200506d5329317f490f47.tar.gz |
string.c: add missing size_t cast
Add size_t cast to avoid signed integer overflow. r56157 ("string.c:
avoid signed integer overflow", 2016-09-13) missed this. Suppresses
UBSan.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -130,7 +130,7 @@ VALUE rb_cSymbol; #define RESIZE_CAPA_TERM(str,capacity,termlen) do {\ if (STR_EMBED_P(str)) {\ if (!STR_EMBEDDABLE_P(capacity, termlen)) {\ - char *const tmp = ALLOC_N(char, (capacity)+termlen);\ + char *const tmp = ALLOC_N(char, (size_t)(capacity) + (termlen));\ const long tlen = RSTRING_LEN(str);\ memcpy(tmp, RSTRING_PTR(str), tlen);\ RSTRING(str)->as.heap.ptr = tmp;\ |