agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig @ 2026-08-04 04:09 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2026-08-04 04:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAligned Fix missing NULL check in MemoryContextAllocAligned(). The underlying call to MemoryContextAllocExtended() could return NULL when flags contains MCXT_ALLOC_NO_OOM and the underlying malloc fails. There are no current callers using MemoryContextAllocAligned() that pass the MCXT_ALLOC_NO_OOM in core, so no live bug fix in core here. However, an extension might use this pattern, so we'd better fix. Fix this so we correctly pass the NULL to the caller rather than trying to write to a NULL memory address. This also fixes the same bug in AlignedAllocRealloc(), which is also unused in core. Backpatch to v16, where these functions first appeared. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/07DAC4C3-120D-4F3C-8FEE-BA236F7E9C1D@gmail.com Backpatch-through: 16 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/03f420c37f898b817d24ee6af55eb5e41ec51655 Modified Files -------------- src/backend/utils/mmgr/mcxt.c | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig @ 2026-08-04 04:09 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2026-08-04 04:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAligned Fix missing NULL check in MemoryContextAllocAligned(). The underlying call to MemoryContextAllocExtended() could return NULL when flags contains MCXT_ALLOC_NO_OOM and the underlying malloc fails. There are no current callers using MemoryContextAllocAligned() that pass the MCXT_ALLOC_NO_OOM in core, so no live bug fix in core here. However, an extension might use this pattern, so we'd better fix. Fix this so we correctly pass the NULL to the caller rather than trying to write to a NULL memory address. This also fixes the same bug in AlignedAllocRealloc(), which is also unused in core. Backpatch to v16, where these functions first appeared. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/07DAC4C3-120D-4F3C-8FEE-BA236F7E9C1D@gmail.com Backpatch-through: 16 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5cb0f004f179435dcb53b94e9b5827d540886b42 Modified Files -------------- src/backend/utils/mmgr/mcxt.c | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig @ 2026-08-04 04:10 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2026-08-04 04:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAligned Fix missing NULL check in MemoryContextAllocAligned(). The underlying call to MemoryContextAllocExtended() could return NULL when flags contains MCXT_ALLOC_NO_OOM and the underlying malloc fails. There are no current callers using MemoryContextAllocAligned() that pass the MCXT_ALLOC_NO_OOM in core, so no live bug fix in core here. However, an extension might use this pattern, so we'd better fix. Fix this so we correctly pass the NULL to the caller rather than trying to write to a NULL memory address. This also fixes the same bug in AlignedAllocRealloc(), which is also unused in core. Backpatch to v16, where these functions first appeared. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/07DAC4C3-120D-4F3C-8FEE-BA236F7E9C1D@gmail.com Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bf048f0e17a1ea82dc22c8ad446d14670b52451c Modified Files -------------- src/backend/utils/mmgr/mcxt.c | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig @ 2026-08-04 04:10 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2026-08-04 04:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAligned Fix missing NULL check in MemoryContextAllocAligned(). The underlying call to MemoryContextAllocExtended() could return NULL when flags contains MCXT_ALLOC_NO_OOM and the underlying malloc fails. There are no current callers using MemoryContextAllocAligned() that pass the MCXT_ALLOC_NO_OOM in core, so no live bug fix in core here. However, an extension might use this pattern, so we'd better fix. Fix this so we correctly pass the NULL to the caller rather than trying to write to a NULL memory address. This also fixes the same bug in AlignedAllocRealloc(), which is also unused in core. Backpatch to v16, where these functions first appeared. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/07DAC4C3-120D-4F3C-8FEE-BA236F7E9C1D@gmail.com Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cce758797f75c19080801ddad213f46d7900ec2b Modified Files -------------- src/backend/utils/mmgr/mcxt.c | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig @ 2026-08-04 04:10 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2026-08-04 04:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAligned Fix missing NULL check in MemoryContextAllocAligned(). The underlying call to MemoryContextAllocExtended() could return NULL when flags contains MCXT_ALLOC_NO_OOM and the underlying malloc fails. There are no current callers using MemoryContextAllocAligned() that pass the MCXT_ALLOC_NO_OOM in core, so no live bug fix in core here. However, an extension might use this pattern, so we'd better fix. Fix this so we correctly pass the NULL to the caller rather than trying to write to a NULL memory address. This also fixes the same bug in AlignedAllocRealloc(), which is also unused in core. Backpatch to v16, where these functions first appeared. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/07DAC4C3-120D-4F3C-8FEE-BA236F7E9C1D@gmail.com Backpatch-through: 16 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b48a8cc0e50ad2cfa604ca89765b9fbec58b0717 Modified Files -------------- src/backend/utils/mmgr/mcxt.c | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-08-04 04:10 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-04 04:09 pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig David Rowley <drowley@postgresql.org> 2026-08-04 04:09 pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig David Rowley <drowley@postgresql.org> 2026-08-04 04:10 pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig David Rowley <drowley@postgresql.org> 2026-08-04 04:10 pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig David Rowley <drowley@postgresql.org> 2026-08-04 04:10 pgsql: Fix missing MCXT_ALLOC_NO_OOM handling in MemoryContextAllocAlig David Rowley <drowley@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox