diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2019-08-12 17:39:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2019-08-12 17:39:09 +0300 |
| commit | 2b329ed420eb15f6738edd402697ac2876b2aa61 (patch) | |
| tree | e0f0a19c6c32e7733f8300ecd4522c1c5ada59eb /src/editfns.c | |
| parent | dbae38efc22e117c20f6cd9bfd8300d692055c70 (diff) | |
| download | emacs-2b329ed420eb15f6738edd402697ac2876b2aa61.tar.gz | |
; Add commentary to recent changes
* src/image.c (png_load_body):
* src/editfns.c (styled_format):
* src/casefiddle.c (do_casify_multibyte_string):
* src/alloc.c (free_cons): Comment why we use a signed
temporary integer variable. (Bug#37006)
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index 25f80bedb1c..19bbfdcd478 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3158,12 +3158,14 @@ 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; - /* Allocate the info and discarded tables. */ + /* 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) || 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. |
