Fix compute_size_with_overflow().

Fix compute_size_with_overflow() to use a high_bits mask that has the
high bits set, rather than the low bits.  This regression was introduced
by 5154ff32ee (Unify the allocation
paths).
This commit is contained in:
Jason Evans 2017-02-03 15:30:42 -08:00
parent d27f29b468
commit 767ffa2b5f

View File

@ -1521,7 +1521,7 @@ compute_size_with_overflow(dynamic_opts_t *dopts, size_t *size) {
*/ */
/* A size_t with its high-half bits all set to 1. */ /* A size_t with its high-half bits all set to 1. */
const static size_t high_bits = SIZE_T_MAX >> (sizeof(size_t) * 8 / 2); const static size_t high_bits = SIZE_T_MAX << (sizeof(size_t) * 8 / 2);
*size = dopts->item_size * dopts->num_items; *size = dopts->item_size * dopts->num_items;