[pacman-dev] "memory clobber before allocated" -S bug

Dan McGee dpmcgee at gmail.com
Wed Jan 24 20:51:53 EST 2007


On 1/24/07, James Rosten <seinfeld90 at gmail.com> wrote:
> This is similar to what Travis reported, but instead of happening on packages
> that exist it happens when pacman3 can't find the package in the db.
> For example:
>
>  [~]
>  james->monkeybox : sudo pacman3 -S random_junk --debug=1

Here is some debug output, starting with the output of the not found
error message. You may  want to get right up to this point and do some
work, printing variables and such. Keep in mind you need to run it on
a non-static version of pacman; why it doesn't show up in the static
linkage I have no idea.

-Dan

(starts at line 553, src/pacman/sync.c)

553                                                     if(prov) {
(gdb) n
563                                                     ERR(NL,
_("'%s': not found in sync db\n"), targ);
(gdb) s
pm_fprintf (file=0xb7e2c560, line=0, fmt=0x80542f8 "error: ") at log.c:114
114             if(neednl == 1 && line == NL) {
(gdb) s
108     {
(gdb) s
114             if(neednl == 1 && line == NL) {
(gdb) s
119             va_start(args, fmt);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) s
119             va_start(args, fmt);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) s
123             len = strlen(str);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) s
s123            len = strlen(str);
(gdb) s
125       if(needpad == 1 && str[len-1] == '\n') {
(gdb) s
131             fprintf(file, str);
(gdb) s
error: 132              if(needpad == 1) {
(gdb) p needpad
$1 = 0
(gdb) p len
No symbol "len" in current context.
(gdb) p str
$2 = "error: \000d�\236�)\236ҷ\001\000\000\000T�\236���\236�l�\236�ĺ\236�k\nӷC\000\000US\000utf8\000\b\006\000\000\000LC_MESSAGES/pacman.mo\000\236�o\233ҷS\001��\024\233\005\bp\217ҷ��\236��S��8\233\005\b\005\000\000\000�\231\005\bD!���3\224\b`2\224\b(�\236�error:
\000X)\224\b\220~��T�\236�p\217ҷ�Fз����XZ���\f\t\b��\236���\236�X?\224\b�\231\005\b\221>���B\005\b\000\000\000\000"...
(gdb) s
144             fflush(file);
(gdb) s
145     }
(gdb) s
pacman_sync (targets=0x8059c08) at sync.c:496
496                                                     ERR(NL,
_("pacman: %s\n"), alpm_strerror(pm_errno));
(gdb) s
pm_fprintf (file=0xb7e2c560, line=1,
    fmt=0x80562ee "'%s': not found in sync db\n") at log.c:114
114             if(neednl == 1 && line == NL) {
(gdb) s
108     {
(gdb) s
114             if(neednl == 1 && line == NL) {
(gdb) s
119             va_start(args, fmt);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) p str
$3 = "T�\236���\236�C\000_US.utf8\000��\233ҷ�\231\005\b8\233\005\b\006\000\000\000\201>��LC_MESSAGES/pacman.mo\000ҷS\001��\024\233\005\bp\217ҷo\000\236�o\233ҷS\001��8\233\005\b\005\000\000\000�\231\005\b�S��8\233\005\b\005\000\000\000�\231\005\b'%s':
not found in sync
db\n\000\220~��T�\236�p\217ҷ�Fз����XZ���\f\t\b\200�\236���\236�X?\224\b�\231\005\b\221>���b\005\b\000\000\000\000"...
(gdb) s
119             va_start(args, fmt);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) s
123             len = strlen(str);
(gdb) s
120             vsnprintf(str, LOG_STR_LEN, fmt, args);
(gdb) s
123             len = strlen(str);
(gdb) s
125       if(needpad == 1 && str[len-1] == '\n') {
(gdb) s
131             fprintf(file, str);
(gdb) s
'random_junk': not found in sync db
132             if(needpad == 1) {
(gdb) s
144             fflush(file);
(gdb) s
145     }
(gdb) s
pacman_sync (targets=0x8059c08) at sync.c:758
758             if(data) {
(gdb) s
759                     alpm_list_free(data);
(gdb) s
memory clobbered before allocated block

Program received signal SIGABRT, Aborted.
0xb7eec410 in ?? ()
(gdb)


More information about the pacman-dev mailing list