aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2019-08-14 18:24:02 -0700
committerPaul Eggert2019-08-14 18:24:33 -0700
commit2098e8afaf1c5235ba38c0156f680b8e435d9fdd (patch)
tree2cde909326273f76ae2bb58b7d7cdfa350951058 /src/image.c
parentb898528fdc69c9ac58895f8be81163dc304bd59b (diff)
downloademacs-2098e8afaf1c5235ba38c0156f680b8e435d9fdd.tar.gz
emacs-2098e8afaf1c5235ba38c0156f680b8e435d9fdd.zip
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/image.c')
-rw-r--r--src/image.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c
index b37851f0963..81d8cb4e2b2 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6463,6 +6463,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6463 png_uint_32 row_bytes; 6463 png_uint_32 row_bytes;
6464 bool transparent_p; 6464 bool transparent_p;
6465 struct png_memory_storage tbr; /* Data to be read */ 6465 struct png_memory_storage tbr; /* Data to be read */
6466 ptrdiff_t nbytes;
6466 Emacs_Pix_Container ximg, mask_img = NULL; 6467 Emacs_Pix_Container ximg, mask_img = NULL;
6467 6468
6468 /* Find out what file to load. */ 6469 /* Find out what file to load. */
@@ -6658,13 +6659,10 @@ 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. */ 6659 /* Number of bytes needed for one row of the image. */
6659 row_bytes = png_get_rowbytes (png_ptr, info_ptr); 6660 row_bytes = png_get_rowbytes (png_ptr, info_ptr);
6660 6661
6661 /* Use a temporary signed variable, since otherwise 6662 /* Allocate memory for the image. */
6662 INT_MULTIPLY_WRAPV might incorrectly return non-zero. */ 6663 if (INT_MULTIPLY_WRAPV (row_bytes, sizeof *pixels, &nbytes)
6663 ptrdiff_t nbytes = sizeof *pixels;
6664 if (INT_MULTIPLY_WRAPV (row_bytes, nbytes, &nbytes)
6665 || INT_MULTIPLY_WRAPV (nbytes, height, &nbytes)) 6664 || INT_MULTIPLY_WRAPV (nbytes, height, &nbytes))
6666 memory_full (SIZE_MAX); 6665 memory_full (SIZE_MAX);
6667 /* Allocate memory for the image. */
6668 c->pixels = pixels = xmalloc (nbytes); 6666 c->pixels = pixels = xmalloc (nbytes);
6669 c->rows = rows = xmalloc (height * sizeof *rows); 6667 c->rows = rows = xmalloc (height * sizeof *rows);
6670 for (i = 0; i < height; ++i) 6668 for (i = 0; i < height; ++i)