summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-03-11 20:15:27 -0400
committerMark H Weaver <mhw@netris.org>2014-03-11 21:39:08 -0400
commit5fbf0e0f99431f54da032bda47d8125f9d34b4b1 (patch)
treef8ad5687837a5574b7619d0f071e0d39a03824c8
parent19c0bd22a8f5e7cd76cf1435504c8eca342285ff (diff)
downloadguile-5fbf0e0f99431f54da032bda47d8125f9d34b4b1.tar.gz
Avoid signed overflow in random.c.
* libguile/random.c (scm_i_mask32): Avoid signed overflow from shifting an unsigned char (promoted to signed int) 24 bits to the left.
-rw-r--r--libguile/random.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libguile/random.c b/libguile/random.c
index 18737aa5a..4051d1f34 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -255,7 +255,7 @@ scm_i_mask32 (scm_t_uint32 m)
? scm_masktab[m >> 8] << 8 | 0xff
: (m < 0x1000000
? scm_masktab[m >> 16] << 16 | 0xffff
- : scm_masktab[m >> 24] << 24 | 0xffffff)));
+ : ((scm_t_uint32) scm_masktab[m >> 24]) << 24 | 0xffffff)));
}
scm_t_uint32