Re: Avoid possible overflow (src/port/bsearch_arg.c)
От | Heikki Linnakangas |
---|---|
Тема | Re: Avoid possible overflow (src/port/bsearch_arg.c) |
Дата | |
Msg-id | 08507458-8222-483c-9234-150d1a607efe@iki.fi обсуждение исходный текст |
Ответ на | Re: Avoid possible overflow (src/port/bsearch_arg.c) (Tomas Vondra <tomas@vondra.me>) |
Список | pgsql-hackers |
On 28/10/2024 17:30, Tomas Vondra wrote: >> Some of those other implementations have fixed this, others have not. >> And they all seem to also have the "involes" typo in the comment that we >> fixed in commit 7ef8b52cf07 :-). Ranier, you might want to submit this >> fix to those other projects too. > > Thanks for fixing this, although I wonder if we can actually hit this, > as we don't really allocate more than 1GB in most places. But it's > possible, and the pre-bfa2cee code handled it fine. Yeah, I didn't check closely I'm pretty sure none of the current callsites can pass anything near INT_MAX elements. While we're at it, there's this in dicts/spell.h: > /* > * Structure to store Hunspell options. Flag representation depends on flag > * type. These flags are about support of compound words. > */ > typedef struct CompoundAffixFlag > { > union > { > /* Flag name if flagMode is FM_CHAR or FM_LONG */ > const char *s; > /* Flag name if flagMode is FM_NUM */ > uint32 i; > } flag; > /* we don't have a bsearch_arg version, so, copy FlagMode */ > FlagMode flagMode; > uint32 value; > } CompoundAffixFlag; We have bsearch_arg() now, so we could switch to that and remove 'flagMode' from here. -- Heikki Linnakangas Neon (https://neon.tech)
В списке pgsql-hackers по дате отправления: