ptr->u.s.u.chain = cons_free_list;
ptr->u.s.car = dead_object ();
cons_free_list = ptr;
- if (consing_until_gc <= 0)
- consing_until_gc += sizeof *ptr;
- else if (INT_ADD_WRAPV (consing_until_gc, sizeof *ptr, &consing_until_gc))
+ int incr = sizeof *ptr;
+ if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc))
consing_until_gc = OBJECT_CT_MAX;
gcstat.total_free_conses++;
}
ptrdiff_t size = SCHARS (obj), n;
USE_SAFE_ALLOCA;
+ ptrdiff_t casing_str_buf_size = sizeof (struct casing_str_buf);
if (INT_MULTIPLY_WRAPV (size, MAX_MULTIBYTE_LENGTH, &n)
- || INT_ADD_WRAPV (n, sizeof (struct casing_str_buf), &n))
+ || INT_ADD_WRAPV (n, casing_str_buf_size, &n))
n = PTRDIFF_MAX;
unsigned char *dst = SAFE_ALLOCA (n);
unsigned char *dst_end = dst + n;
ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1;
/* Allocate the info and discarded tables. */
- ptrdiff_t info_size, alloca_size;
- if (INT_MULTIPLY_WRAPV (nspec_bound, sizeof *info, &info_size)
+ 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);
png_uint_32 row_bytes;
bool transparent_p;
struct png_memory_storage tbr; /* Data to be read */
- ptrdiff_t nbytes;
Emacs_Pix_Container ximg, mask_img = NULL;
/* Find out what file to load. */
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
/* Allocate memory for the image. */
- if (INT_MULTIPLY_WRAPV (row_bytes, sizeof *pixels, &nbytes)
+ ptrdiff_t nbytes = sizeof *pixels;
+ if (INT_MULTIPLY_WRAPV (row_bytes, nbytes, &nbytes)
|| INT_MULTIPLY_WRAPV (nbytes, height, &nbytes))
memory_full (SIZE_MAX);
c->pixels = pixels = xmalloc (nbytes);