summaryrefslogtreecommitdiff
path: root/src/coding.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-05-18 09:04:57 +0800
committerPo Lu <luangruo@yahoo.com>2023-05-18 09:04:57 +0800
commit074c0268fd32d6527e124cff386bb6b15cf90017 (patch)
tree62111c3c70d46a738f15514e988a707409ca45f4 /src/coding.c
parentdb48eff8cf4a88393c0209f663ca194ee37fa747 (diff)
parent5ef169ed701fa4f850fdca5563cdd468207d5d4f (diff)
downloademacs-feature/android.tar.gz
Merge remote-tracking branch 'origin/master' into feature/androidfeature/android
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c7
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))