From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Mark Dilger <hornschnorter(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Memory bug in dsnowball_lexize |
Date: | 2019-05-23 15:46:10 |
Message-ID: | 12465.1558626370@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Mark Dilger <hornschnorter(at)gmail(dot)com> writes:
> In src/backend/snowball/libstemmer/utilities.c, 'create_s' uses
> malloc (not palloc) to allocate memory, and on memory exhaustion
> returns NULL rather than throwing an exception.
Actually not, see macros in src/include/snowball/header.h.
> In src/backend/snowball/dict_snowball.c, 'dsnowball_lexize'
> calls 'SN_set_current' and ignores the return value, thereby
> failing to notice the error, if any.
Hm. This seems like possibly a bug, in that even if we cover the
malloc issue, there's no API guarantee that OOM is the only possible
reason for reporting failure.
> There is a comment higher up in dict_snowball.c that seems to
> use some handwaving about all this, or perhaps it is documenting
> something else entirely. In any event, I find the documentation
> about dictCtx insufficient to explain why this memory handling
> is correct.
Fair complaint --- do you want to propose some new wording that
references what header.h does?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Pantelis Theodosiou | 2019-05-23 15:50:57 | Re: PostgreSQL 12 Beta 1 press release draft |
Previous Message | Pantelis Theodosiou | 2019-05-23 15:36:06 | Re: PostgreSQL 12 Beta 1 press release draft |