diff options
author | Yifan Lu | 2016-11-23 14:34:33 -0600 |
---|---|---|
committer | Yifan Lu | 2016-11-23 14:34:33 -0600 |
commit | bd5ebb7a0a4e102731de72832f3e12e9f54d541a (patch) | |
tree | bef4f637a270d3f7d2551ac74a89e6b4bad8adec /lib/darwin/read.c | |
parent | Fixed proper encoding of PUSH (STMDB) as ARM manual was wrong... (diff) | |
parent | avoid UB (diff) | |
download | substitute-bd5ebb7a0a4e102731de72832f3e12e9f54d541a.tar.gz |
Merge branch 'master' of https://github.com/comex/substitute
Diffstat (limited to 'lib/darwin/read.c')
-rw-r--r-- | lib/darwin/read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/darwin/read.c b/lib/darwin/read.c index 2e5b746..a0a5d8e 100644 --- a/lib/darwin/read.c +++ b/lib/darwin/read.c @@ -9,11 +9,11 @@ bool read_leb128(void **ptr, void *end, bool is_signed, uint64_t *out) { return false; bit = *p++; uint64_t k = bit & 0x7f; - if (shift < sizeof(uint64_t) * 8) + if (shift < 64) result |= k << shift; shift += 7; } while (bit & 0x80); - if (is_signed && (bit & 0x40)) + if (is_signed && (bit & 0x40) && shift < 64) result |= ~((uint64_t) 0) << shift; *ptr = p; if (out) |