tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* makewhatis: segfault in dbadd when using -a
@ 2021-08-06 23:53 sternenseemann
  2021-08-11 15:09 ` Ingo Schwarze
  0 siblings, 1 reply; 7+ messages in thread
From: sternenseemann @ 2021-08-06 23:53 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

Hi all,

while testing Ingo's latest patch I found a segfault in makewhatis
involving -a and symlinks which I can also reproduce on unpatched CVS.

To reproduce do something like this

mkdir test-manpath
mkdir -p test-manpath/de/man1
ln -sf $(realpath test-manpath/de) test-manpath/DE

So we have a base directory which has one child that is a symlink. This
symlink points to a directory below the base directory which contains
another directory. Running makewhatis -a test-manpath will then segfault
with the following backtrace:

#0  0x000000000041a9e1 in dbadd (dba=dba@entry=0x471050,
mpage=mpage@entry=0x473560) at mandocdb.c:2140
#1  0x000000000041b0ae in mpages_merge (dba=dba@entry=0x471050,
mp=mp@entry=0x46c2b0) at mandocdb.c:1294
#2  0x000000000041ca13 in mandocdb (argc=1, argc@entry=3,
argv=<optimized out>, argv@entry=0x7fffffffd678) at mandocdb.c:513
#3  0x000000000041dffa in main (argc=3, argv=0x7fffffffd678) at main.c:165

Full backtrace is attached as well. I've stared at mpages_merge for a
little bit, but haven't figured out how this is happening so far.

Cheers,

  Lukas

[-- Attachment #2: makewhatis-full-backtrace --]
[-- Type: text/plain, Size: 3304 bytes --]

#0  0x000000000041a9e1 in dbadd (dba=dba@entry=0x471050, mpage=mpage@entry=0x473560) at mandocdb.c:2140
        mlink = 0x472510
        key = <optimized out>
        cp = 0x476460 "DE"
        mask = <optimized out>
        i = 2
        slot = 0
        mustfree = 0
        __PRETTY_FUNCTION__ = "dbadd"
#1  0x000000000041b0ae in mpages_merge (dba=dba@entry=0x471050, mp=mp@entry=0x46c2b0) at mandocdb.c:1294
        mpage = 0x473560
        mpage_dest = <optimized out>
        mlink = 0x0
        mlink_dest = <optimized out>
        meta = 0x46ca00
        cp = 0x437301 <hash_calloc> "H\203\354\b\350\\\374\377\377H\203\304\b\303H\203\354\b\350p\374\377\377H\203\304\b\303H\203\354\070dH\213\004%("
        fd = <optimized out>
        __PRETTY_FUNCTION__ = "mpages_merge"
#2  0x000000000041ca13 in mandocdb (argc=1, argc@entry=3, argv=<optimized out>, argv@entry=0x7fffffffd678) at mandocdb.c:513
        conf = {output = {includes = 0x0, man = 0x0, outfilename = 0x0, paper = 0x0, style = 0x0, tag = 0x0, tagfilename = 0x0, indent = 0, width = 0, fragment = 0, mdoc = 0, noval = 0, synopsisonly = 0, tag_found = 0, toc = 0}, manpath = {paths = 0x46d0c0, sz = 1}}
        mp = 0x46c2b0
        dba = 0x471050
        path_arg = <optimized out>
        progname = <optimized out>
        j = 0
        sz = <optimized out>
        ch = <optimized out>
        i = <optimized out>
#3  0x000000000041dffa in main (argc=3, argv=0x7fffffffd678) at main.c:165
        conf = {output = {includes = 0x100000 <error: Cannot access memory at address 0x100000>, man = 0x0, outfilename = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, paper = 0x8000 <error: Cannot access memory at address 0x8000>, style = 0x0, 
            tag = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, tagfilename = 0x0, indent = 140737488347803, width = 140737354082303, fragment = 0, mdoc = 0, noval = 0, synopsisonly = 0, tag_found = 0, toc = 0}, manpath = {paths = 0x0, sz = 140737353989472}}
        outst = {tag_files = 0x1, outdata = 0xffffffffffffffff, use_pager = 4096, wstop = 0, had_output = 256, outtype = OUTT_ASCII}
        ws = {ws_row = 2048, ws_col = 0, ws_xpixel = 0, ws_ypixel = 0}
        search = {arch = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, sec = 0xc0000 <error: Cannot access memory at address 0xc0000>, outkey = 0x0, argmode = 4294967295, firstmatch = -1}
        res = 0x40
        resn = 0x38000000380
        mp = <optimized out>
        conf_file = <optimized out>
        os_s = <optimized out>
        progname = 0x7fffffffda72 "makewhatis"
        sec = <optimized out>
        defpaths = <optimized out>
        auxpaths = <optimized out>
        oarg = 0x38000000380 <error: Cannot access memory at address 0x38000000380>
        tagarg = <optimized out>
        uc = <optimized out>
        ressz = 17179870080
        resnsz = 1048576
        i = <optimized out>
        ib = <optimized out>
        ssz = <optimized out>
        options = <optimized out>
        show_usage = <optimized out>
        prio = <optimized out>
        best_prio = <optimized out>
        startdir = <optimized out>
        c = <optimized out>
        os_e = MANDOC_OS_OTHER
        outmode = <optimized out>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-06 17:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 23:53 makewhatis: segfault in dbadd when using -a sternenseemann
2021-08-11 15:09 ` Ingo Schwarze
2021-08-18 22:02   ` sternenseemann
2021-08-19 17:11     ` Ingo Schwarze
2021-09-06 14:50       ` Ingo Schwarze
2021-09-06 15:52         ` sternenseemann
2021-09-06 17:12           ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).