suppress integer overflow warnings

* random.c: annotate rb_hash_start with NO_SANITIZE (seed.key.hash + h
  overflows and that seems intentional)
* bignum.c: avoid (size_t)--
* cont.c: ditto
* util.c: ditto
* vm_insnhelper.c: ditto



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-11-13 00:40:52 +00:00
parent 803dcea481
commit 7f6691ae77
5 changed files with 21 additions and 13 deletions

10
util.c
View file

@ -54,8 +54,16 @@ ruby_scan_hex(const char *start, size_t len, size_t *retlen)
register const char *s = start;
register unsigned long retval = 0;
const char *tmp;
size_t i = 0;
while (len-- && *s && (tmp = strchr(hexdigit, *s))) {
for (i = 0; i < len; i++) {
if (! s[0]) {
break;
}
tmp = strchr(hexdigit, *s);
if (! tmp) {
break;
}
retval <<= 4;
retval |= (tmp - hexdigit) & 15;
s++;