pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Harden Memoization code against broken data types
Date: Wed, 08 Jun 2022 00:40:06 +0000
Message-ID: <E1nyjjy-003DjR-93@gemulon.postgresql.org> (raw)

Harden Memoization code against broken data types

Bug #17512 highlighted that a suitably broken data type could cause the
backend to crash if either the hash function or equality function were in
someway non-deterministic based on their input values.  Such a data type
could cause a crash of the backend due to some code which assumes that
we'll always find a hash table entry corresponding to an item in the
Memoize LRU list.

Here we remove the assumption that we'll always find the entry
corresponding to the given LRU list item and add run-time checks to verify
we have found the given item in the cache.

This is not a fix for bug #17512, but it will turn the crash reported by
that bug report into an internal ERROR.

Reported-by: Ales Zeleny
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/CAApHDvpxFSTwvoYWT7kmFVSZ9zLAeHb=S9vrz=RExMgSkQNWqw@mail.gmail.com
Backpatch-through: 14, where Memoize was added.

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cbcea3b91dcd242473dfdc5464dcfb53dae2bdf4

Modified Files
--------------
src/backend/executor/nodeMemoize.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)



view thread (2+ messages)

Message-ID: <E1nyjjy-003DjR-93@gemulon.postgresql.org>
Permalink:  ../E1nyjjy-003DjR-93@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nyjjy-003DjR-93@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Harden Memoization code against broken data types
  In-Reply-To: <E1nyjjy-003DjR-93@gemulon.postgresql.org>
  References: <E1nyjjy-003DjR-93@gemulon.postgresql.org>

* 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