From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com>, Ankit Kumar Pandey <itsankitkp(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17888: Incorrect memory access in gist__int_ops for an input array with many elements |
Date: | 2023-05-31 06:00:00 |
Message-ID: | f7ab52bb-e0ee-4acd-9bb1-ac28d22e39f5@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
07.04.2023 11:57, Richard Guo wrote:
>
> On Fri, Apr 7, 2023 at 4:21 AM PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>
> NOTICE: input array is too big (199 maximum allowed, 1001 current), use
> gist__intbig_ops opclass instead
>
>
> In g_int_compress,
>
> if (ARRNELEMS(r) >= 2 * num_ranges)
> elog(NOTICE, "input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
> 2 * num_ranges - 1, ARRNELEMS(r));
>
> Wondering why elog with NOTICE rather than Error here.
The NOTICE appeared there in commit 08ee64ebf5 (from year 2005) in an
attempt to get rid of flags (ISLEAFKEY(in)) [1] and probably expressed
an intention to play gently (don't break compatibility?).
The patch proposed at [2] looks correct to me. Thank you, Ankit!
Though I would add a simple case to the intarray regression test and also
add errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED) to other two places in
_int_gist.c for the sake of consistency.
Please look at the patches attached.
[1] https://www.postgresql.org/message-id/43786274.3020200%40sigaev.ru
[2] https://www.postgresql.org/message-id/796b65c3-57b7-bddf-b0d5-a8afafb8b627%40gmail.com
Attachment | Content-Type | Size |
---|---|---|
v2-01-gist-int-ops-overflow.patch | text/x-patch | 2.0 KB |
v2-02-gist-int-errcodes.patch | text/x-patch | 1.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ken McClaren | 2023-05-31 17:49:11 | Order of operations in postgreSQL. |
Previous Message | Michael Paquier | 2023-05-30 11:56:39 | Re: BUG #17938: could not open shared memory segment "/PostgreSQL.615216676": No such file or directory |