Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] db/gdbm rewrite



On Thu, 16 Feb 2017 08:25:24 -0800
Sebastian Gniazdowski <psprint2@xxxxxxxxxxxx> wrote:

> On Thu, Feb 16, 2017, at 08:03 AM, Sebastian Gniazdowski wrote:
> > On Thu, Feb 16, 2017, at 07:11 AM, Peter Stephenson wrote:
> > > % zmodload zsh/db/gdbm
> > > % ztie -d db/gdbm -f db.gdbm dbase
> > > % dbase[testkey]=somewhat
> > > ==25034== Invalid write of size 1
> > > ==25034==    at 0x80E0B78: metafy (utils.c:4652)
> > 
> > I've used HEAP_ALLOC instead of HEAP_DUP in argument for metafy. Fixing
> > this resolves valgrind report. Important catch.. Hopefully it will
> > resolve enable-zsh-mem problem (I cannot reproduce that). Sending as
> > complete patch plus db_gdbm.c file.
> 
> Yeah this will fix the problem. I did:
> 
>         pm->u.str = metafy(content.dptr, content.dsize, META_ALLOC);
> 
> There were no meta characters so metafy() didn't allocate memory,
> returned internal GDBM  pointer. META_DUP always allocates. Thanks!

Yes, test now runs in the case where it originally failed with zsh
allocation.

I think that's probably all the sanity checking this is going to get in
these parts.  Unless someone screams in appropriately technical language
(or, even better, wants to do some checking of their own) I'll commit
it.

pws



Messages sorted by: Reverse Date, Date, Thread, Author