summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-10-02 12:58:04 +0300
committerEli Zaretskii <eliz@gnu.org>2022-10-02 12:58:04 +0300
commit7ff520762468b5de4684e4a3d8f0103c8f3bec64 (patch)
tree2db7176bb363f6b97ff8b239b92cd0ed8cfb53ed
parent6c46aa2116557ab3fa4f9c81e50a30246e2614d8 (diff)
downloademacs-7ff520762468b5de4684e4a3d8f0103c8f3bec64.tar.gz
Avoid assertion violation in 'xpalloc'
* src/emacs.c (load_pdump): Ensure the 3rd argument of xpalloc is always positive. (Bug#58232)
-rw-r--r--src/emacs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 0a90b0913be..602fa802e0b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -903,7 +903,7 @@ load_pdump (int argc, char **argv)
exenamelen = prefix_length;
}
ptrdiff_t needed = exenamelen + strlen (suffix) + 1;
- dump_file = xpalloc (NULL, &bufsize, needed - bufsize, -1, 1);
+ dump_file = xpalloc (NULL, &bufsize, max (1, needed - bufsize), -1, 1);
memcpy (dump_file, emacs_executable, exenamelen);
strcpy (dump_file + exenamelen, suffix);
result = pdumper_load (dump_file, emacs_executable);