aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorEli Zaretskii2019-08-12 17:39:09 +0300
committerEli Zaretskii2019-08-12 17:39:09 +0300
commit2b329ed420eb15f6738edd402697ac2876b2aa61 (patch)
treee0f0a19c6c32e7733f8300ecd4522c1c5ada59eb /src/image.c
parentdbae38efc22e117c20f6cd9bfd8300d692055c70 (diff)
downloademacs-2b329ed420eb15f6738edd402697ac2876b2aa61.tar.gz
emacs-2b329ed420eb15f6738edd402697ac2876b2aa61.zip
; 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/image.c')
-rw-r--r--src/image.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/image.c b/src/image.c
index a59be0cd8ff..b37851f0963 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6658,11 +6658,13 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6658 /* Number of bytes needed for one row of the image. */ 6658 /* Number of bytes needed for one row of the image. */
6659 row_bytes = png_get_rowbytes (png_ptr, info_ptr); 6659 row_bytes = png_get_rowbytes (png_ptr, info_ptr);
6660 6660
6661 /* Allocate memory for the image. */ 6661 /* Use a temporary signed variable, since otherwise
6662 INT_MULTIPLY_WRAPV might incorrectly return non-zero. */
6662 ptrdiff_t nbytes = sizeof *pixels; 6663 ptrdiff_t nbytes = sizeof *pixels;
6663 if (INT_MULTIPLY_WRAPV (row_bytes, nbytes, &nbytes) 6664 if (INT_MULTIPLY_WRAPV (row_bytes, nbytes, &nbytes)
6664 || INT_MULTIPLY_WRAPV (nbytes, height, &nbytes)) 6665 || INT_MULTIPLY_WRAPV (nbytes, height, &nbytes))
6665 memory_full (SIZE_MAX); 6666 memory_full (SIZE_MAX);
6667 /* Allocate memory for the image. */
6666 c->pixels = pixels = xmalloc (nbytes); 6668 c->pixels = pixels = xmalloc (nbytes);
6667 c->rows = rows = xmalloc (height * sizeof *rows); 6669 c->rows = rows = xmalloc (height * sizeof *rows);
6668 for (i = 0; i < height; ++i) 6670 for (i = 0; i < height; ++i)