Skip to content

Commit e243de0

Browse files
committed
amcheck: Fix incorrect use of VARATT_IS_COMPRESSED.
The macro is being applied to a TOAST pointer, not a varlena header. Therefore the use of VARATT_IS_COMPRESSED() is wrong. We can check VARATT_EXTERNAL_IS_COMPRESSED(), but then we don't need the length check that follows. Report and fix by Kyotaro Horiguchi. Discussion: http://postgr.es/m/20220517.162719.1671558681467343711.horikyota.ntt@gmail.com
1 parent 9f0b953 commit e243de0

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

contrib/amcheck/verify_heapam.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,19 +1385,11 @@ check_tuple_attribute(HeapCheckContext *ctx)
13851385
toast_pointer.va_rawsize,
13861386
VARLENA_SIZE_LIMIT));
13871387

1388-
if (VARATT_IS_COMPRESSED(&toast_pointer))
1388+
if (VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer))
13891389
{
13901390
ToastCompressionId cmid;
13911391
bool valid = false;
13921392

1393-
/* Compression should never expand the attribute */
1394-
if (VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer) > toast_pointer.va_rawsize - VARHDRSZ)
1395-
report_corruption(ctx,
1396-
psprintf("toast value %u external size %u exceeds maximum expected for rawsize %d",
1397-
toast_pointer.va_valueid,
1398-
VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer),
1399-
toast_pointer.va_rawsize));
1400-
14011393
/* Compressed attributes should have a valid compression method */
14021394
cmid = TOAST_COMPRESS_METHOD(&toast_pointer);
14031395
switch (cmid)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy