GNU bug report logs -
#58232
29.0.50; alloc.c:879: assertion failed: 0 < item_size && 0 < nitems_incr_min && 0 <= n0 && -1 <= nitems_max
Previous Next
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Sat, 1 Oct 2022 16:34:02 UTC
Severity: normal
Found in version 29.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 58232 <at> debbugs.gnu.org (full text, mbox):
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: 58232 <at> debbugs.gnu.org
> Date: Sun, 02 Oct 2022 14:47:33 +0530
>
> (gdb) frame 6
> #6 0x000055a416dad158 in load_pdump (argc=2, argv=0x7fffc2172b98) at emacs.c:935
> 935 dump_file = xpalloc (NULL, &bufsize, needed - bufsize, -1, 1);
> (gdb) p needed
> $1 = 41
> (gdb) p bufsize
> $2 = 128
> (gdb) p exenamelen
> $3 = 35
> (gdb) p emacs_executable
> $4 = 0x55a41793af20 "/home/viz/lib/ports/emacs/src/emacs"
> (gdb) p suffix
> $5 = 0x55a41701a648 ".pdmp"
Ouch! Please try the patch below.
diff --git a/src/emacs.c b/src/emacs.c
index 91bf0a9..00c381a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -932,7 +932,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);
This bug report was last modified 2 years and 256 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.