NetBSD-Bugs archive

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

Re: bin/52678: makemandb crashes



On Tue, Oct 31, 2017 at 7:45 AM,  <martin%netbsd.org@localhost> wrote:
>>Number:         52678
>>Category:       bin
>>Synopsis:       makemandb crashes
>>Confidential:   no
>>Severity:       critical
>>Priority:       high
>>Responsible:    bin-bug-people
>>State:          open
>>Class:          sw-bug
>>Submitter-Id:   net
>>Arrival-Date:   Tue Oct 31 07:45:00 +0000 2017
>>Originator:     Martin Husemann
>>Release:        NetBSD 8.99.5
>>Organization:
> The NetBSD Foundation, Inc.
>>Environment:
> System: NetBSD whoever-brings-the-night.aprisoft.de 8.99.5 NetBSD 8.99.5 (WHOEVER) #183: Sat Oct 28 16:48:01 CEST 2017 martin%seven-days-to-the-wolves.aprisoft.de@localhost:/work/src/sys/arch/sparc64/compile/WHOEVER sparc64
> Architecture: sparc64
> Machine: sparc64
>>Description:
>
> Running makemandb (like done at system startup) crashes on sparc64 with
> a SIGBUS:
>
> Program received signal SIGBUS, Bus error.
> 0x0000000000134690 in porter_stemmer (pnOut=0xffffffffffffcc8c,
>     zOut=0x42876f60 "x\234+/NJÍ\311\001", nIn=<optimized out>,
>     zIn=<optimized out>)
>     at /work/src/usr.sbin/makemandb/custom_apropos_tokenizer.c:625
> 625     /work/src/usr.sbin/makemandb/custom_apropos_tokenizer.c: No such file or directory.
> (gdb) bt
> #0  0x0000000000134690 in porter_stemmer (pnOut=0xffffffffffffcc8c,
>     zOut=0x42876f60 "x\234+/NJÍ\311\001", nIn=<optimized out>,
>     zIn=<optimized out>)
>     at /work/src/usr.sbin/makemandb/custom_apropos_tokenizer.c:625
> #1  do_stem (pnOut=0xffffffffffffcc8c, zOut=0x42876f60 "x\234+/NJÍ\311\001",
>     nIn=<optimized out>, zIn=<optimized out>)
>     at /work/src/usr.sbin/makemandb/custom_apropos_tokenizer.c:654
> #2  aproposPorterNext (pCursor=0x4284af00, pzToken=0xffffffffffffcc90,
>     pnBytes=0xffffffffffffcc8c, piStartOffset=0xffffffffffffcc80,
>     piEndOffset=0xffffffffffffcc84, piPosition=0xffffffffffffcc88)
>     at /work/src/usr.sbin/makemandb/custom_apropos_tokenizer.c:719
> #3  0x000000004053442c in fts3PendingTermsAdd (p=p@entry=0x4250a408,
>     iLangid=iLangid@entry=0, zText=<optimized out>, iCol=iCol@entry=1,
>     pnWord=pnWord@entry=0x4287c0c4)
>     at /work/src/external/public-domain/sqlite/lib/../dist/sqlite3.c:155641
> #4  0x00000000405aac54 in fts3InsertTerms (aSz=<optimized out>,
>     apVal=<optimized out>, iLangid=<optimized out>, p=<optimized out>)
>     at /work/src/external/public-domain/sqlite/lib/../dist/sqlite3.c:155745
> #5  sqlite3Fts3UpdateMethod (pRowid=<optimized out>, apVal=<optimized out>,
>     nArg=<optimized out>, pVtab=0x4250a408)
>     at /work/src/external/public-domain/sqlite/lib/../dist/sqlite3.c:29384
>
> the size_t pointer *pnOut is misaligned. It comes from line 719:
>
>  int stemStatus = do_stem(&z[iStartOffset], n, c->zToken, (size_t *) pnBytes);
>
> and pnBytes only is an int pointer. Either make pnBytes a size_t * as well,

We cannot change the type of the function argument since it is the
interface expected by SQLite.

> or call with a temporary size_t and assign:
>
>   size_t temp = *pnBytes;
>   int stemStatus = do_stem(&z[iStartOffset], n, c->zToken, &temp);
>   *pnBytes = temp;

This sounds better. Since you have proposed this fix, I am guessing it
works on Sparc64. :)
Should I commit it?


Regards
Abhinav


Home | Main Index | Thread Index | Old Index