ptr->u.s.u.chain = cons_free_list;
ptr->u.s.car = dead_object ();
cons_free_list = ptr;
+ /* Use a temporary signed variable, since otherwise INT_ADD_WRAPV
+ might incorrectly return non-zero. */
int incr = sizeof *ptr;
if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc))
consing_until_gc = OBJECT_CT_MAX;
ptrdiff_t size = SCHARS (obj), n;
USE_SAFE_ALLOCA;
+ /* Use a temporary signed variable, since otherwise INT_ADD_WRAPV
+ might incorrectly return non-zero. */
ptrdiff_t casing_str_buf_size = sizeof (struct casing_str_buf);
if (INT_MULTIPLY_WRAPV (size, MAX_MULTIBYTE_LENGTH, &n)
|| INT_ADD_WRAPV (n, casing_str_buf_size, &n))
/* Upper bound on number of format specs. Each uses at least 2 chars. */
ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1;
- /* Allocate the info and discarded tables. */
+ /* Use a temporary signed variable, since otherwise INT_ADD_WRAPV
+ might incorrectly return non-zero. */
ptrdiff_t info_size = sizeof *info, alloca_size;
if (INT_MULTIPLY_WRAPV (nspec_bound, info_size, &info_size)
|| INT_ADD_WRAPV (formatlen, info_size, &alloca_size)
|| SIZE_MAX < alloca_size)
memory_full (SIZE_MAX);
+ /* Allocate the info and discarded tables. */
info = SAFE_ALLOCA (alloca_size);
/* discarded[I] is 1 if byte I of the format
string was not copied into the output.
/* Number of bytes needed for one row of the image. */
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
- /* Allocate memory for the image. */
+ /* Use a temporary signed variable, since otherwise
+ INT_MULTIPLY_WRAPV might incorrectly return non-zero. */
ptrdiff_t nbytes = sizeof *pixels;
if (INT_MULTIPLY_WRAPV (row_bytes, nbytes, &nbytes)
|| INT_MULTIPLY_WRAPV (nbytes, height, &nbytes))
memory_full (SIZE_MAX);
+ /* Allocate memory for the image. */
c->pixels = pixels = xmalloc (nbytes);
c->rows = rows = xmalloc (height * sizeof *rows);
for (i = 0; i < height; ++i)