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>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)
Date: 2026-10-27 01:13:19
Message-ID: SN7P223MB060015B8ADE3B413969FE2F0DD602@SN7P223MB0600.NAMP223.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Takeshi,

Thanks again for the review and the alternative patch.
Attached is v2, which adopts your strtoi64 approach as
discussed.

The crypt-sha.c change is the one you suggested: parse rounds=
with strtoi64() so out-of-range values saturate into the
existing clamping, and report the value as supplied in the
clamp NOTICEs. The regression tests are carried over from v1
unchanged.

Behaviour is identical to v1 on the full test battery,
including the values beyond int64 in both directions, and the
pgcrypto regression suite passes 25/25.

As noted before, sha-crypt support exists only in PG 18 and
master, so backpatching to REL_18_STABLE should be considered.

Testing was done with AI assistance.

Regards,
Prashant Chinnam

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-10-27 01:13:36 Re: Event trigger table rewrite doc missing ALTER MATERIALIZED VIEW case
Previous Message Prashant Chinnam 2026-10-27 00:39:31 Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)