Dear Maintainer, When starting gmemusage, it immediately crashes: $ gmemusage realloc(): invalid next size Aborted
Hello, Looks like caused by having not enough space for process names longer than 13 characters. A package built with the modification below shows no longer this crash. Kind regard, Bernhard (gdb) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x00007f43d244b15f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 0x00007f43d23fd472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007f43d23e74b2 in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007f43d23e81ed in __libc_message (fmt=fmt@entry=0x7f43d255a78c "%s\n") at ../sysdeps/posix/libc_fatal.c:150 #5 0x00007f43d2454a75 in malloc_printerr (str=str@entry=0x7f43d2558326 "realloc(): invalid next size") at ./malloc/malloc.c:5658 #6 0x00007f43d245876c in _int_realloc (av=av@entry=0x7f43d2594c80 <main_arena>, oldp=oldp@entry=0x564149c00680, oldsize=oldsize@entry=912, nb=nb@entry=1808) at ./malloc/malloc.c:4836 #7 0x00007f43d2459596 in __GI___libc_realloc (oldmem=oldmem@entry=0x564149c00690, bytes=bytes@entry=1792) at ./malloc/malloc.c:3477 #8 0x0000564148a039a5 in addProc (procname=procname@entry=0x7fffa8056900 "cpuhp/3", mem=0, rss=0) at hash.c:89 #9 0x0000564148a03f20 in makeProcs () at proc.c:215 #10 0x0000564148a02e32 in draw_window () at gmemusage.c:489 #11 0x0000564148a02b85 in main (argc=<optimized out>, argv=<optimized out>) at gmemusage.c:300 benutzer@debian:~$ valgrind gmemusage ==1246== Memcheck, a memory error detector ==1246== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==1246== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==1246== Command: gmemusage ==1246== ==1246== Invalid write of size 1 ==1246== at 0x48468E4: strcpy (vg_replace_strmem.c:553) ==1246== by 0x10B958: addProc (hash.c:101) ==1246== by 0x10BF1F: makeProcs (proc.c:215) ==1246== by 0x10AE31: draw_window (gmemusage.c:489) ==1246== by 0x10AB84: main (gmemusage.c:300) ==1246== Address 0x4e6b740 is 0 bytes after a block of size 3,584 alloc'd ==1246== at 0x484582F: realloc (vg_replace_malloc.c:1437) ==1246== by 0x10B9A4: addProc (hash.c:89) ==1246== by 0x10BF1F: makeProcs (proc.c:215) ==1246== by 0x10AE31: draw_window (gmemusage.c:489) ==1246== by 0x10AB84: main (gmemusage.c:300) ==1246==--- hash.c.orig 1998-01-14 17:43:13.000000000 +0100 +++ hash.c 2023-11-25 11:26:06.292932169 +0100 @@ -10,2 +10,3 @@ #include <malloc.h> +#include <string.h> #include "common.h" @@ -73,3 +74,4 @@ addProc ( char *procname , int mem , int thisproc = nextproc = procs ; - strcpy ( thisproc -> procname , procname ) ; + strncpy ( thisproc -> procname , procname , sizeof(thisproc -> procname) ) ; + thisproc -> procname[sizeof(thisproc -> procname)-1] = '\0'; thisproc -> totMem = mem ; @@ -100,3 +102,4 @@ addProc ( char *procname , int mem , int thisproc = procs + nProcs ; - strcpy ( thisproc -> procname , procname ) ; + strncpy ( thisproc -> procname , procname , sizeof(thisproc -> procname) ) ; + thisproc -> procname[sizeof(thisproc -> procname)-1] = '\0'; thisproc -> totMem = mem ;
Hi,
as per ITS I have uploaded the package to delayed=10.
Kind regards
Andreas.
We believe that the bug you reported is fixed in the latest version of
gmemusage, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1055607@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Andreas Tille <tille@debian.org> (supplier of updated gmemusage package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 02 Dec 2024 08:35:12 +0100
Source: gmemusage
Architecture: source
Version: 0.2-12
Distribution: unstable
Urgency: medium
Maintainer: Package Salvaging Team <team+salvage@tracker.debian.org>
Changed-By: Andreas Tille <tille@debian.org>
Closes: 1055607 1077947 1081585 1087323
Changes:
gmemusage (0.2-12) unstable; urgency=medium
.
[ Andreas Tille ]
* Team upload.
* Maintain package in Package Salvage team
Closes: #1087323
* Set Homepage to unofficial SVN
Closes: #1081585
* Fake watch file since upstream is dead
* Provide int argument for draw_window
Closes: #1077947
* Switch from cdbs to dh
* Standards-Version: 4.7.0 (routine-update)
* debhelper-compat 13 (routine-update)
* Rules-Requires-Root: no (routine-update)
* Trim trailing whitespace.
* d/copyright: DEP5
.
[ Bernhard Übelacker ]
* Provide enough space for process names longer than 13 characters
Closes: #1055607
Checksums-Sha1:
ff9bfa470bba9d6ee6b732119daf62adcad4c77c 1945 gmemusage_0.2-12.dsc
2ee1562403fdb650ba3da616546f47423006a080 6436 gmemusage_0.2-12.debian.tar.xz
240bf85609b83fd653643685c7953a5bc4b960e6 6528 gmemusage_0.2-12_amd64.buildinfo
Checksums-Sha256:
abd97ec5ce95f2514a04dbcb3a9ceb65fc671f1ada5aa479ba6b54df733c16a9 1945 gmemusage_0.2-12.dsc
7e21deb2939ce957f2a41ffc0cccced1bd0e9f14023eb61095831a6bf50f07c3 6436 gmemusage_0.2-12.debian.tar.xz
2aea31cc5ff30395f00cf005785dddfd216ec14ea1f3f653651f757feccbbdbe 6528 gmemusage_0.2-12_amd64.buildinfo
Files:
b0b760eb63d944479e0adf38df9869bf 1945 utils optional gmemusage_0.2-12.dsc
d31cec25370e248086509abab5a4ec4e 6436 utils optional gmemusage_0.2-12.debian.tar.xz
afe8cc58221ccd819c1cd98f17d3623e 6528 utils optional gmemusage_0.2-12_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQJFBAEBCgAvFiEE8fAHMgoDVUHwpmPKV4oElNHGRtEFAmdNY9oRHHRpbGxlQGRl
Ymlhbi5vcmcACgkQV4oElNHGRtFpexAAl62KwDfUzfjG5xuUPMymnPGv3IEBkIqP
NaduZE3OsXmeQWpuDCtdDor1faMtbPFMw72k2LTXN4YO2mY0uVKavUnuuDau4r21
ngAxk14dSdM45/CmE+db2qQuBnAj+AlrJ8hTBr++DwHyQuJiYchp6GbO85W1L/UA
w9qPy/LXx2jGBecd+h9MeuFUiIn++prwq7JiCCUyNWlCoIZushnGjoFv4TgCTjfw
PgTdke76nXLu6JBa46S8F/wYlYYbF93LWVw8rt1tR6Ged695R+9MD1iVIBHCpLqo
67eui7i8+0xbEhb4osor8V7lG9Rgz5dwc4HSF5H6Ty7PE/gpvcFoMaLOJFy7/XHn
Yi+O/J6nMyndT1FLn0LCf2fAbOJmepdgJVxey41My0uApo8QH0SlgiRxJnHbSKx7
I57juoYx9Ase8tV7uHNu2xpkDKRg5q8yJsIpDnmlj7AjBW6d2wYOEDZXhsqtSSRi
hAAMnVQQVKqo2SaB64tBOInKHHXKLjTCrBqJIM9btku4c4LcIrz5PwNriYEO20UE
fJcFzMt1rxzt2BeWDWS5wDl/z5MUrG1/u0DpISKMxa9Iw5VEnTczwxlcICz46RIv
j79zMdl7D97OrrGRLRYXCBddagLqma3sjJKpfsZNvL1mxA8zSUvs/trLYkzW9k4y
KA+LeBdivxQ=
=D409
-----END PGP SIGNATURE-----