| From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | A latent pointer increment bug in pgtypes_defmt_scan() |
| Date: | 2026-11-19 07:22:06 |
| Message-ID: | 20261119.162206.639378539262920864.horikyota.ntt@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello,
While looking at another patch, I noticed the following code.
dt_common.c:2485:
> while (**pstr == ' ')
> pstr++;
Since *pstr points to a single string, and the code later uses
"while (**pstr == ' ') (*pstr)++;", I think this was intended to skip
leading spaces, but actually advances the wrong pointer.
If this code were actually executed, it could cause a crash in the
worst case. However, the caller already skips leading spaces in
**pstr, so this is effectively dead code and probably hasn't caused
any problems.
I think the function itself needs to skip leading spaces to locate the
start of a token, so this part should be fixed as follows.
while (**pstr == ' ')
- pstr++;
+ (*pstr)++;
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-incorrect-pointer-increment-in-pgtypes_defmt_.patch | text/x-patch | 1001 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-11-19 07:35:07 | Re: Use an index scan in RemoveSubscriptionRel() |
| Previous Message | David Rowley | 2026-11-19 07:20:51 | Block various aggregate component functions from being called directly |