Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)

From: Prashant Chinnam <crprashant(at)hotmail(dot)com>
To: Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)
Date: 2026-10-30 18:41:08
Message-ID: SN7P223MB06000F7441991868A1050DE7DD6D2@SN7P223MB0600.NAMP223.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is v4 of this patch.

As promised in the strtoint() thread, now that Tom's
commit 426551c8cf49 has landed and been backpatched
through PG 14 (REL_18_STABLE: ec65cbc00b2c), this
version switches the rounds= parse back to strtoint(),
relying on its new saturating behavior on overflow.

The delta against v3 is exactly one line in
crypt-sha.c (strtoi64() -> strtoint()); the clamping,
the NOTICE print cap, and all regression tests are
unchanged from v3. I verified it locally against
current master: the pgcrypto suite passes 25/25, and
the overflow battery and NOTICE probe output are
identical to v3.

Since the strtoint() change is backpatched, this
version should backpatch to REL_18_STABLE cleanly as
well.

Testing was done with AI assistance.

Regards,
Prashant Chinnam

Attachment Content-Type Size
v4-0001-pgcrypto-Fix-sha-crypt-rounds-values-that-do-not-fit.patch application/octet-stream 31.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2026-10-30 19:13:47 Re: WAL record CRC calculated incorrectly because of underlying buffer modification
Previous Message Kirill Reshke 2026-10-30 18:38:13 ALTER COLLATION misses errcode