emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 7ff5207624: Avoid assertion violation in 'xpalloc'


From: Eli Zaretskii
Subject: emacs-28 7ff5207624: Avoid assertion violation in 'xpalloc'
Date: Sun, 2 Oct 2022 05:58:52 -0400 (EDT)

branch: emacs-28
commit 7ff520762468b5de4684e4a3d8f0103c8f3bec64
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Avoid assertion violation in 'xpalloc'
    
    * src/emacs.c (load_pdump): Ensure the 3rd argument of xpalloc is
    always positive.  (Bug#58232)
---
 src/emacs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/emacs.c b/src/emacs.c
index 0a90b0913b..602fa802e0 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]