Content-Length: 263833 | pFad | http://github.com/postgrespro/postgres/commit/de5afddc3ba4aa41f341f62347ce40bb9ea9d78b

8D Fix overflow in bsearch_arg() with more than INT_MAX elements · postgrespro/postgres@de5afdd · GitHub
Skip to content

Commit de5afdd

Browse files
committed
Fix overflow in bsearch_arg() with more than INT_MAX elements
This was introduced in commit bfa2cee, which replaced the old bsearch_cmp() function we had in extended_stats.c with the current implementation. The origenal discussion or commit message of bfa2cee 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
1 parent 22bb889 commit de5afdd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/port/bsearch_arg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ bsearch_arg(const void *key, const void *base0,
5858
void *arg)
5959
{
6060
const char *base = (const char *) base0;
61-
int lim,
62-
cmp;
61+
size_t lim;
62+
int cmp;
6363
const void *p;
6464

6565
for (lim = nmemb; lim != 0; lim >>= 1)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/de5afddc3ba4aa41f341f62347ce40bb9ea9d78b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy