agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Nathan Bossart <nathandbossart@gmail.com>
To: Хамидуллин Рустам <r.khamidullin@postgrespro.ru>
Cc: Mats Kindahl <mats@timescale.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: glibc qsort() vulnerability
Date: Fri, 24 Jul 2026 16:01:13 -0400
Message-ID: <amPEiUFpt1RNhYBk@nathan> (raw)
In-Reply-To: <5c5a7984-b149-b505-7ad9-2a7766c65b55@postgrespro.ru>
References: <20240212213130.jp5vwotwazypaaez@awork3.anarazel.de>
<20240212230423.GA3519@nathanxps13>
<20240212234134.ilwrxvwyza3vvps7@awork3.anarazel.de>
<CA+14424WBPAsZDk+yq1dMv=aZeF2ePehv+t9rRMur51-FJc0gA@mail.gmail.com>
<20240213181044.GA13935@nathanxps13>
<20240215233219.GA1204090@nathanxps13>
<CA+144256aiJqpF9M6+82br97hJLMySFReuXxTc_te3aqsZ=ouA@mail.gmail.com>
<20240216200951.GA1511686@nathanxps13>
<CA+14424bbhPnWze3PUo0-5smdo8t_1sDLvOsCHM4aRhousf4KQ@mail.gmail.com>
<5c5a7984-b149-b505-7ad9-2a7766c65b55@postgrespro.ru>
On Fri, Jul 24, 2026 at 06:12:03PM +0300, Хамидуллин Рустам wrote:
> static int
> db_comparator(const void *a, const void *b)
> {
> - if (((const avl_dbase *) a)->adl_score == ((const avl_dbase *) b)->adl_score)
> - return 0;
> - else
> - return (((const avl_dbase *) a)->adl_score < ((const avl_dbase *) b)->adl_score) ? 1 : -1;
> + return pg_cmp_s32(((const avl_dbase *) a)->adl_score,
> + ((const avl_dbase *) b)->adl_score);
> }
>
> It breaks the database vacuuming order. The order should clearly be different here.
> This bug was introduced in PostgreSQL 17. I have attached а fix.
Oops, I think you're right. Thanks for reporting. I'll plan on committing
this sometime next week.
--
nathan
view thread (64+ messages) latest in thread
Message-ID: <amPEiUFpt1RNhYBk@nathan>
Permalink: ../amPEiUFpt1RNhYBk@nathan/
Also on: postgresql.org/message-id/amPEiUFpt1RNhYBk@nathan
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, r.khamidullin@postgrespro.ru, mats@timescale.com, andres@anarazel.de, tgl@sss.pgh.pa.us, thomas.munro@gmail.com, hlinnaka@iki.fi, pgsql-hackers@lists.postgresql.org
Subject: Re: glibc qsort() vulnerability
In-Reply-To: <amPEiUFpt1RNhYBk@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox