pgsql: Properly determine length for on-disk TOAST values

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Properly determine length for on-disk TOAST values
Date: 2019-11-16 02:07:46
Message-ID: E1iVnV4-0002ki-Lf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Properly determine length for on-disk TOAST values

In detoast_attr_slice, VARSIZE_ANY was used to compute compressed length
of on-disk TOAST values. That's incorrect, because the varlena value may
be just a TOAST pointer, producing either bogus value or crashing.

This is likely why the code was crashing on big-endian machines before
540f31680913 replaced the VARSIZE with VARSIZE_ANY, which however only
masked the issue.

Reported-by: Rushabh Lathia
Discussion: https://postgr.es/m/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2dc08bd6179d8cf480c93701010c19ad7a9891d8

Modified Files
--------------
src/backend/access/common/detoast.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-11-16 06:24:21 pgsql: Improve stability of tests for VACUUM (SKIP_LOCKED)
Previous Message Tomas Vondra 2019-11-16 01:34:43 pgsql: Skip system attributes when applying mvdistinct stats