pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
@ 2025-05-11 00:22  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-05-11 00:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect "return NULL" in BumpAllocLarge().

This must be "return MemoryContextAllocationFailure(context, size, flags)"
instead.  The effect of this oversight is that if we got a malloc
failure right here, the code would act as though MCXT_ALLOC_NO_OOM
had been specified, whether it was or not.  That would likely lead
to a null-pointer-dereference crash at the unsuspecting call site.

Noted while messing with a patch to improve our Valgrind leak
detection support.  Back-patch to v17 where this code came in.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d4a7e4e179f946e12708f758d30a07f931fd5a84

Modified Files
--------------
src/backend/utils/mmgr/bump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
@ 2025-05-11 00:22  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-05-11 00:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect "return NULL" in BumpAllocLarge().

This must be "return MemoryContextAllocationFailure(context, size, flags)"
instead.  The effect of this oversight is that if we got a malloc
failure right here, the code would act as though MCXT_ALLOC_NO_OOM
had been specified, whether it was or not.  That would likely lead
to a null-pointer-dereference crash at the unsuspecting call site.

Noted while messing with a patch to improve our Valgrind leak
detection support.  Back-patch to v17 where this code came in.

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a05cf22e0540e55fb34e26e6e98a8a76b76d1cbd

Modified Files
--------------
src/backend/utils/mmgr/bump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-05-11 00:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-05-11 00:22 pgsql: Fix incorrect "return NULL" in BumpAllocLarge(). Tom Lane <tgl@sss.pgh.pa.us>
2025-05-11 00:22 pgsql: Fix incorrect "return NULL" in BumpAllocLarge(). Tom Lane <tgl@sss.pgh.pa.us>

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