glibc qsort() vulnerability - Mailing list pgsql-hackers

From Mats Kindahl
Subject glibc qsort() vulnerability
Date
Msg-id CA+14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw@mail.gmail.com
Whole thread Raw
Responses Re: glibc qsort() vulnerability
List pgsql-hackers
Hi hackers,

There is a bug in glibc's qsort() algorithm that runs the risk of creating an out-of-bounds error if the comparison function is not transitive, for example, if subtraction is used so that it can create an overflow.


I checked the existing functions in the latest version of Postgres source code and most are safe, but there were a few ones that could lead to overflow. I do not know if these can actually lead to problems, but better safe than sorry, so I created a patch to fix those few cases and add a comment to one case that was not clear that it could not overflow.

Best wishes,
Mats Kindahl, Timescale
Attachment

pgsql-hackers by date:

Previous
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: Synchronizing slots from primary to standby
Next
From: Peter Eisentraut
Date:
Subject: Re: Possibility to disable `ALTER SYSTEM`