Re: BUG #17874: Incorrect memory access at gistBuildCallback

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: kyzevan23@mail.ru, pgsql-bugs@lists.postgresql.org
Date: 2023-03-29T10:00:00Z
Lists: pgsql-bugs
Hi Egor,

28.03.2023 19:01, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      17874
> Logged by:          Egor Chindyaskin
> Email address:      kyzevan23@mail.ru
> PostgreSQL version: 15.2
> Operating system:   Ubuntu 22.04
> Description:
>
> With a server compiled with flag -DUSE_VALGRIND the following query:
>
> create table test(a int4, b point);
>
> create index test_index on test using gist(b) with (buffering = on,
> fillfactor=50);
> drop index test_index;
> insert into test (a, b) select g, point(g*10, g*10) from generate_series(1,
> 10000) g;
> vacuum analyze test;
>
> ...
>
> causes an incorrect memory access:
>
> ==00:00:00:20.465 256552== Invalid read of size 2
> ==00:00:00:20.465 256552==    at 0x20EE4F: gistBuildCallback
> (gistbuild.c:921)
> ...
>
> This issue reproduces on all supported branches.

That issue was reported already as bug #16329:
https://www.postgresql.org/message-id/flat/16329-7a6aa9b6fa1118a1%40postgresql.org

Maybe it's worth to register the fix proposed there for the next commitfest...

Best regards,
Alexander



Commits

  1. Fix dereference of dangling pointer in GiST index buffering build.