diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-11-16 02:40:02 +0100 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-11-16 03:07:11 +0100 |
commit | 2dc08bd6179d8cf480c93701010c19ad7a9891d8 (patch) | |
tree | e5d7ec8f6ee92ee76789599cc0028cfb71a6e2b9 /src | |
parent | d482f7f867b58bbd29f65a4471eca8c5b57a7da0 (diff) | |
download | postgresql-2dc08bd6179d8cf480c93701010c19ad7a9891d8.tar.gz postgresql-2dc08bd6179d8cf480c93701010c19ad7a9891d8.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/common/detoast.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index f752ac7bbc9..8c89fc2a558 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -233,7 +233,7 @@ detoast_attr_slice(struct varlena *attr, * of a given length (after decompression). */ max_size = pglz_maximum_compressed_size(sliceoffset + slicelength, - TOAST_COMPRESS_SIZE(attr)); + toast_pointer.va_extsize); /* * Fetch enough compressed slices (compressed marker will get set |