Fix overflow in bsearch_arg() with more than INT_MAX elements
authorHeikki Linnakangas <[email protected]>
Mon, 28 Oct 2024 12:07:38 +0000 (14:07 +0200)
committerHeikki Linnakangas <[email protected]>
Mon, 28 Oct 2024 12:08:00 +0000 (14:08 +0200)
commit07ca2d4110d474669fa03203782b5dae24f1c5c6
tree4c48242917078cf56506818703f4d7d813b9022f
parent431e05181e4172415decf618ada8e91d6df995b1
Fix overflow in bsearch_arg() with more than INT_MAX elements

This was introduced in commit bfa2cee784, which replaced the old
bsearch_cmp() function we had in extended_stats.c with the current
implementation. The original discussion or commit message of
bfa2cee784 didn't mention where the new implementation came from, but
based on some googling, I'm guessing *BSD or libiberty, all of which
share this same code, with or without this fix.

Author: Ranier Vilela
Reviewed-by: Nathan Bossart
Backpatch-through: 14
Discussion: https://www.postgresql.org/message-id/CAEudQAp34o_8u6sGSVraLwuMv9F7T9hyHpePXHmRaxR2Aboi%2Bw%40mail.gmail.com
src/port/bsearch_arg.c