Re: Potential buffer overrun in spell.c's CheckAffix()

x4mmm@yandex-team.ru

From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2026-04-30T07:56:17Z
Lists: pgsql-bugs

> On 23 Apr 2026, at 12:58, Andrey Borodin <x4mmm@yandex-team.ru> wrote:
> 
> Yes, 40Kb in NIImportOOAffixes() is a lot. But is it important in grand scheme of
> things? Minimum max_stack_depth is 100Kb, ought to be enough…

IsAffixFlagInUse(), addCompoundAffixFlagValue() and getCompoundAffixFlagValue()
also allocate 8Kb on stack...
Would it make sense to add check_stack_depth() into addCompoundAffixFlagValue()?
Other prominent allocators (NIImportOOAffixes(),NIImportAffixes()) call it anyway.
At least we will know if disaster is around the corner.


Best regards, Andrey Borodin.


Commits

  1. Prevent some buffer overruns in spell.c's parsing of affix files.

  2. Prevent buffer overrun in spell.c's CheckAffix().