mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix overflow in bsearch_arg() with more than INT_MAX elements
This was introduced in commitbfa2cee784, which replaced the old bsearch_cmp() function we had in extended_stats.c with the current implementation. The original discussion or commit message ofbfa2cee784didn'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
This commit is contained in:
		@@ -58,8 +58,8 @@ bsearch_arg(const void *key, const void *base0,
 | 
			
		||||
			void *arg)
 | 
			
		||||
{
 | 
			
		||||
	const char *base = (const char *) base0;
 | 
			
		||||
	int			lim,
 | 
			
		||||
				cmp;
 | 
			
		||||
	size_t		lim;
 | 
			
		||||
	int			cmp;
 | 
			
		||||
	const void *p;
 | 
			
		||||
 | 
			
		||||
	for (lim = nmemb; lim != 0; lim >>= 1)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user