[PATCH] dynahash: add memory allocation failure check

From: m(dot)korotkov(at)postgrespro(dot)ru
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] dynahash: add memory allocation failure check
Date: 2025-04-23 08:32:42
Message-ID: 219bdccd460510efaccf90b57e5e5ef2@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,
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.
---
Best regards, Korotkov Maksim
PostgresPro
m(dot)korotkov(at)postgrespro(dot)ru

Attachment Content-Type Size
0001-dynahash-add-memory-allocation-failure-check.patch text/x-diff 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2025-04-23 08:47:36 Re: What's our minimum supported Python version?
Previous Message Zhijie Hou (Fujitsu) 2025-04-23 08:20:53 RE: Fix premature xmin advancement during fast forward decoding