# HG changeset patch # User Philipp Kutin # Date 1375872870 -7200 # Node ID aada14bf74ed2835e1c3866f07b121ad2ec25c51 # Parent af2051e363ea2a65ff6a7dbec8e9c59c7a12cd99 randmtzig.c: prevent left-shift of a 1 into sign bit in oct_init_by_entropy(). * randmtzig.c: in expression "word[0] + ... + (word[3]<<24)", cast the latter to uint32_t before shifting, preventing (C99) undefined behavior. diff -r af2051e363ea -r aada14bf74ed liboctave/numeric/randmtzig.c --- a/liboctave/numeric/randmtzig.c Wed Aug 07 07:35:01 2013 -0700 +++ b/liboctave/numeric/randmtzig.c Wed Aug 07 12:54:30 2013 +0200 @@ -268,7 +268,7 @@ unsigned char word[4]; if (fread (word, 4, 1, urandom) != 1) break; - entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+(word[3]<<24); + entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+((uint32_t)word[3]<<24); } fclose (urandom); }