Skip to content

Commit 466bb2b

Browse files
committed
Do not attempt to decode LP_UNUSED line pointers
We previously called FormatItem on each item even when it was LP_UNUSED. On x86_64, that was not a problem since the items seen in the test suite had lp_len == 0, but on big-endian s390x, there are items with a non-zero length and the decoder would complain about garbage. "Good" case: Item 1 -- Length: 0 Offset: 773 (0x0305) Flags: UNUSED Item 2 -- Length: 0 Offset: 0 (0x0000) Flags: UNUSED "Bad" case: Item 1 -- Length: 0 Offset: 0 (0x0000) Flags: UNUSED Item 2 -- Length: 758 Offset: 0 (0x0000) Flags: UNUSED Block Id: 0 linp Index: 402 Size: 7936 Has Nulls: 1 Has Varwidths: 1 Error: Index item size difference. Given <758>, Internal <7936>.
1 parent 8590294 commit 466bb2b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pg_filedump.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ FormatItemBlock(char *buffer,
15311531
indent, indent, blockSize, bytesToFormat, itemOffset + itemSize);
15321532
exitCode = 1;
15331533
}
1534-
else
1534+
else if (itemFlags != LP_UNUSED)
15351535
{
15361536
HeapTupleHeader tuple_header;
15371537
TransactionId xmax;
@@ -1584,10 +1584,10 @@ FormatItemBlock(char *buffer,
15841584
/* Decode tuple data */
15851585
FormatDecode(&buffer[itemOffset], itemSize);
15861586
}
1587-
1588-
if (!isToast && x == maxOffset)
1589-
printf("\n");
15901587
}
1588+
1589+
if (!isToast && x == maxOffset)
1590+
printf("\n");
15911591
}
15921592
}
15931593
}
@@ -1631,7 +1631,7 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
16311631

16321632
if (numBytes != IndexTupleSize(itup))
16331633
{
1634-
printf(" Error: Item size difference. Given <%u>, "
1634+
printf(" Error: Index item size difference. Given <%u>, "
16351635
"Internal <%d>.\n", numBytes, (int) IndexTupleSize(itup));
16361636
exitCode = 1;
16371637
}
@@ -1660,7 +1660,7 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
16601660

16611661
if (numBytes != itup->size)
16621662
{
1663-
printf(" Error: Item size difference. Given <%u>, "
1663+
printf(" Error: SPGiST inner item size difference. Given <%u>, "
16641664
"Internal <%d>.\n", numBytes, (int) itup->size);
16651665
exitCode = 1;
16661666
}
@@ -1733,7 +1733,7 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
17331733

17341734
if (numBytes != itup->size)
17351735
{
1736-
printf(" Error: Item size difference. Given <%u>, "
1736+
printf(" Error: SPGiST leaf item size difference. Given <%u>, "
17371737
"Internal <%d>.\n", numBytes, (int) itup->size);
17381738
exitCode = 1;
17391739
}

0 commit comments

Comments
 (0)