public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Tomas Vondra <[email protected]>
To: Ranier Vilela <[email protected]>
To: Nathan Bossart <[email protected]>
To: Tomas Vondra <[email protected]>
Cc: Pg Hackers <[email protected]>
Subject: Re: Avoid possible overflow (src/port/bsearch_arg.c)
Date: Mon, 28 Oct 2024 18:52:15 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAEudQAp34o_8u6sGSVraLwuMv9F7T9hyHpePXHmRaxR2Aboi+w@mail.gmail.com>
	<ZwWkBb2gxs5fGttK@nathan>
	<CAEudQAr8KZET1ogPnT7esb7YdYbmJyFZWo-OnP+FgoKeL+N31A@mail.gmail.com>
	<[email protected]>
	<[email protected]>

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)







view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Avoid possible overflow (src/port/bsearch_arg.c)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox