[PATCH] contrib/xml2: guard against signed integer overflow in parse_params

From: Varik Matevosyan <varikmatevosyan(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] contrib/xml2: guard against signed integer overflow in parse_params
Date: 2026-05-04 11:26:50
Message-ID: CA+bBooj48K08uKpAKyciPRdbOJ_5qCqz9nr2m2wzr8E5s102Hw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Small robustness fix for contrib/xml2/parse_params. The doubling
of max_params relies on signed-integer overflow wrapping to a value
that AllocSizeIsValid then rejects, which is both UB and incidental
safety.

The overflow is unreachable in current builds (text input is bounded
by MaxAllocSize, which limits nparams below the doubling threshold),
but the fix is small and matches the explicit overflow-checking
idiom used elsewhere in the tree.

Patch attached against current master.

Regards,
Varik

Attachment Content-Type Size
0001-contrib-xml2-guard-against-signed-integer-overflow-i.patch application/octet-stream 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-05-04 11:28:53 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Jim Jones 2026-05-04 11:24:03 Re: ALTER TABLE: warn when actions do not recurse to partitions