aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index c0179c7584e..ab91aaa4e81 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3245,9 +3245,9 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str,
3245 else 3245 else
3246 nbytes = SBYTES (str); 3246 nbytes = SBYTES (str);
3247 3247
3248 if (INT_ADD_OVERFLOW (ssl->bytes, nbytes)) 3248 if (INT_ADD_WRAPV (ssl->bytes, nbytes, &nbytes))
3249 memory_full (SIZE_MAX); 3249 memory_full (SIZE_MAX);
3250 ssl->bytes += nbytes; 3250 ssl->bytes = nbytes;
3251 3251
3252 if (STRINGP (str2)) 3252 if (STRINGP (str2))
3253 { 3253 {
@@ -3259,9 +3259,9 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str,
3259 else 3259 else
3260 nbytes = SBYTES (str2); 3260 nbytes = SBYTES (str2);
3261 3261
3262 if (INT_ADD_OVERFLOW (ssl->bytes, nbytes)) 3262 if (INT_ADD_WRAPV (ssl->bytes, nbytes, &nbytes))
3263 memory_full (SIZE_MAX); 3263 memory_full (SIZE_MAX);
3264 ssl->bytes += nbytes; 3264 ssl->bytes = nbytes;
3265 } 3265 }
3266} 3266}
3267 3267
@@ -3357,9 +3357,8 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
3357 unsigned char *p; 3357 unsigned char *p;
3358 ptrdiff_t total; 3358 ptrdiff_t total;
3359 3359
3360 if (INT_ADD_OVERFLOW (overlay_heads.bytes, overlay_tails.bytes)) 3360 if (INT_ADD_WRAPV (overlay_heads.bytes, overlay_tails.bytes, &total))
3361 memory_full (SIZE_MAX); 3361 memory_full (SIZE_MAX);
3362 total = overlay_heads.bytes + overlay_tails.bytes;
3363 if (total > overlay_str_len) 3362 if (total > overlay_str_len)
3364 overlay_str_buf = xpalloc (overlay_str_buf, &overlay_str_len, 3363 overlay_str_buf = xpalloc (overlay_str_buf, &overlay_str_len,
3365 total - overlay_str_len, -1, 1); 3364 total - overlay_str_len, -1, 1);