Potential null pointer dereference in postgres.c

From: Karina Litskevich <litskevichkarina(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Potential null pointer dereference in postgres.c
Date: 2024-12-05 16:53:59
Message-ID: CACiT8iZ=atkguKVbpN4HmJFMb4+T9yEowF5JuPZG8W+kkZ9L6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

When backporting 66e94448 to older versions it was forgotten to check
malloc() result. In 16+ versions guc_malloc() is used to allocate
memory and it checks if the result pointer is NULL, so there is no
need to check it after guc_malloc(). Versions before 16 have no
guc_malloc(), and malloc() is used instead, but we have to check if
return value is NULL.

Please find attached patch for REL_15_STABLE. This should be fixed in
older versions too.

Best regards,
Karina Litskevich
Postgres Professional: http://postgrespro.com/

Attachment Content-Type Size
v1-0001-Check-if-malloc-returned-NULL.patch text/x-patch 841 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-12-05 17:00:30 Re: attndims, typndims still not enforced, but make the value within a sane threshold
Previous Message Francesco Degrassi 2024-12-05 16:52:38 Re: RFC/PoC: GUC option to enable tuple queue autoflush for parallel workers