diff options
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c index fbf10188819..96c3827c326 100644 --- a/src/coding.c +++ b/src/coding.c @@ -989,7 +989,7 @@ static void coding_alloc_by_realloc (struct coding_system *coding, ptrdiff_t bytes) { ptrdiff_t newbytes; - if (INT_ADD_WRAPV (coding->dst_bytes, bytes, &newbytes) + if (ckd_add (&newbytes, coding->dst_bytes, bytes) || SIZE_MAX < newbytes) string_overflow (); coding->destination = xrealloc (coding->destination, newbytes); @@ -7059,9 +7059,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, { eassert (growable_destination (coding)); ptrdiff_t dst_size; - if (INT_MULTIPLY_WRAPV (to_nchars, MAX_MULTIBYTE_LENGTH, - &dst_size) - || INT_ADD_WRAPV (buf_end - buf, dst_size, &dst_size)) + if (ckd_mul (&dst_size, to_nchars, MAX_MULTIBYTE_LENGTH) + || ckd_add (&dst_size, dst_size, buf_end - buf)) memory_full (SIZE_MAX); dst = alloc_destination (coding, dst_size, dst); if (EQ (coding->src_object, coding->dst_object)) |