pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pierre Ducroquet <p.psql@pinaraf.info>
Cc: pgsql-hackers@postgresql.org, Oleg Bartunov <obartunov@gmail.com>
Cc: Teodor Sigaev <teodor@sigaev.ru>
Subject: Re: function lca('{}'::ltree[]) caused DB Instance crash
Date: Fri, 13 Jul 2018 10:26:56 -0400
Message-ID: <993.1531492016@sss.pgh.pa.us> (raw)
In-Reply-To: <4285558.KOck4HGOto@peanuts2>
References: <5b0d8e4f-f2a3-1305-d612-e00e35a7be66@qunar.com>
	<4285558.KOck4HGOto@peanuts2>

Pierre Ducroquet <p.psql@pinaraf.info> writes:
> On Friday, July 13, 2018 12:09:20 PM CEST 李海龙 wrote:
>> contrib_regression=# select lca('{}'::ltree[]);
>> server closed the connection unexpectedly

> There is indeed a bug. The _lca function in _ltree_op.c tries to allocate 0 
> bytes of memory, doesn't initialize it and dereference it in lca_inner.
> The attached basic patch fixes it.

I think the defense ought to be in lca_inner not there.

However, I don't understand why this code is returning NULL, rather than
a zero-length ltree, in the case that there's no common prefix.  That
doesn't seem consistent to me.

			regards, tom lane




view thread (4+ messages)  latest in thread

Message-ID: <993.1531492016@sss.pgh.pa.us>
Permalink:  ../993.1531492016@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/993.1531492016@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, p.psql@pinaraf.info, obartunov@gmail.com, teodor@sigaev.ru
  Subject: Re: function lca('{}'::ltree[]) caused DB Instance crash
  In-Reply-To: <993.1531492016@sss.pgh.pa.us>
  References: <5b0d8e4f-f2a3-1305-d612-e00e35a7be66@qunar.com> <4285558.KOck4HGOto@peanuts2> <993.1531492016@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox