From: Richard Biener Date: Mon, 26 Oct 2020 09:10:46 +0000 (+0100) Subject: middle-end/97554 - avoid overflow in alloc size compute X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50f9e1f4d458e36d306b2449c689e45492847f68;p=gcc.git middle-end/97554 - avoid overflow in alloc size compute This avoids overflow in the allocation size computations in sbitmap_vector_alloc when the result exceeds 2GB. 2020-10-26 Richard Biener * sbitmap.c (sbitmap_vector_alloc): Use size_t for byte quantities to avoid overflow. --- diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c index 292e7eede5a..3a43fe35bb1 100644 --- a/gcc/sbitmap.c +++ b/gcc/sbitmap.c @@ -139,7 +139,8 @@ sbitmap_realloc (sbitmap src, unsigned int n_elms) sbitmap * sbitmap_vector_alloc (unsigned int n_vecs, unsigned int n_elms) { - unsigned int i, bytes, offset, elm_bytes, size, amt, vector_bytes; + unsigned int i, size; + size_t amt, bytes, vector_bytes, elm_bytes, offset; sbitmap *bitmap_vector; size = SBITMAP_SET_SIZE (n_elms);