summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-08-14 18:24:02 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-08-14 18:24:33 -0700
commit2098e8afaf1c5235ba38c0156f680b8e435d9fdd (patch)
tree2cde909326273f76ae2bb58b7d7cdfa350951058 /src/editfns.c
parentb898528fdc69c9ac58895f8be81163dc304bd59b (diff)
downloademacs-2098e8afaf1c5235ba38c0156f680b8e435d9fdd.tar.gz
Remove INT_ADD_WRAPV bug workarounds
* src/alloc.c (free_cons): * src/casefiddle.c (do_casify_multibyte_string): * src/editfns.c (styled_format): * src/image.c (png_load_body): Remove recent workarounds for INT_ADD_WRAPV bugs since the bugs have been fixed (Bug#37006).
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 19bbfdcd478..1b33f397110 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3158,14 +3158,12 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
/* Upper bound on number of format specs. Each uses at least 2 chars. */
ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1;
- /* 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)
+ /* Allocate the info and discarded tables. */
+ ptrdiff_t info_size, alloca_size;
+ if (INT_MULTIPLY_WRAPV (nspec_bound, sizeof *info, &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.