summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 04:09:05 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 04:09:05 (GMT)
commit234ffbce0e17464b0c174e3567ffe34917277229 (patch)
tree2cca7ecd4720a332a32520c7d92a07cb8c071398 /random.c
parentc818b2fcf4652869799057556fc528e02288e248 (diff)
blacklist UBSAN's unsigned integer overflow
Integer overflow for unsigned types are fully defined in C. They are not always problematic (but not always OK). These functions in this changeset intentionally utilizes that behaviour. Blacklist from UBSAN checks for better output. See also: https://travis-ci.org/ruby/ruby/jobs/451624829 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/random.c b/random.c
index cd16a57..16f2453 100644
--- a/random.c
+++ b/random.c
@@ -112,6 +112,9 @@ struct MT {
#define genrand_initialized(mt) ((mt)->next != 0)
#define uninit_genrand(mt) ((mt)->next = 0)
+NO_SANITIZE("unsigned-integer-overflow", static void init_genrand(struct MT *mt, unsigned int s));
+NO_SANITIZE("unsigned-integer-overflow", static void init_by_array(struct MT *mt, const uint32_t init_key[], int key_length));
+
/* initializes state[N] with a seed */
static void
init_genrand(struct MT *mt, unsigned int s)