Re: BUG #17888: Incorrect memory access in gist__int_ops for an input array with many elements

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Richard Guo <guofenglinux@gmail.com>, Ankit Kumar Pandey <itsankitkp@gmail.com>, David Rowley <dgrowleyml@gmail.com>, Teodor Sigaev <teodor@sigaev.ru>, pgsql-bugs@lists.postgresql.org
Date: 2023-06-15T10:00:00Z
Lists: pgsql-bugs
Hi Michael,

15.06.2023 07:53, Michael Paquier wrote:
> I have spent some time on that today, and applied what has been
> suggested to restrict the usage of this operator when inserting data
> for a leaf page, so as the decompression does not get crazy when
> retrieving the contents of the leaf pages.

Thank you for paying attention to it!
I closed https://commitfest.postgresql.org/43/4280/ as committed.

The confusing message I noted previously:
ERROR:  index row size 8040 exceeds maximum 8152 for index "test_idx"
is not emitted now, although I think it still can be produced for some
other gist indexes. But that's a matter for another day, I suppose.

Best regards,
Alexander



Commits

  1. intarray: Prevent out-of-bound memory reads with gist__int_ops

  2. Remove usage of ArrayType->flags field, use pgsql's macros BITS_PER_BYTE instead