[PATCH] ecpg: fix missing NULL check in ecpg_store_input

From: "Gladyshev Ilya" <ilya(dot)gladyshev(at)linux(dot)dev>
To: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] ecpg: fix missing NULL check in ecpg_store_input
Date: 2026-08-18 10:58:25
Message-ID: ed5a633b469e685f3a1aef9982cff8e1c50e5883@linux.dev
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

This is my first contribution, so please correct me if anything
is wrong.

During OOM, PGTYPESnumeric_to_asc() can return NULL even on valid
inputs, which can lead to a NULL deref in ecpg_store_input():

```
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
slen = strlen(str);
```

This patch adds the NULL check, matching the surrounding code. This is
unlikely to be hit in practice, so it's more of a hardening than
a real fix.

---
Ilya Gladyshev // foxido.dev

Attachment Content-Type Size
0001-ecpg-Fix-NULL-pointer-crash-in-numeric-parameter-bin.patch text/x-diff 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrizio Mello 2026-08-18 11:23:12 Add contrib module pg_stat_log: cumulative statistics about server log messages
Previous Message Nitin Jadhav 2026-08-18 10:44:24 Re: [WIP] Pipelined Recovery