Re: [PATCH] dynahash: add memory allocation failure check
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: m.korotkov@postgrespro.ru
Cc: pgsql-hackers@postgresql.org
Date: 2025-04-23T13:39:54Z
Lists: pgsql-hackers
Hi Maksim, > I found a case of potential NULL pointer dereference. > In src/backend/utils/hash/dynahash.c in function HTAB *hash_create() the > result of the DynaHashAlloc() is used unsafely. > The function DynaHashAlloc() calls MemoryContextAllocExtended() with > MCXT_ALLOC_NO_OOM and can return a NULL pointer. > Added the pointer check for avoiding a potential problem. Thanks for the patch. It looks correct to me. I didn't check if it needs to be back-ported and if it does - to how many branches. -- Best regards, Aleksander Alekseev
Commits
-
Avoid possibly-theoretical OOM crash hazard in hash_create().
- bc19f63f8010 18.0 landed
- f45bdb13397f 16.9 landed
- e384118559ef 17.5 landed