pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/426551c8cf4902b6164cde1104df3783bfc50483

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/af3a7f7e29da0a5fcada499b7cb891e341030046

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ec65cbc00b2ccc82996e1c94b534e1fbf61fbcd1

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2acade963cb1c6c81c6f09a018ceca43958e1be9

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c1b622766fd9d285d090ee616869ea4fd59deda5

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/756cbe36c63d24a9404f7698829c75f34f741e46

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow.
@ 2026-10-30 15:03 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2026-10-30 15:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Return INT_MAX or INT_MIN from strtoint() on overflow.

Previously, strtoint() set errno to ERANGE on overflow but returned
the result of casting the long value to int. When the value is outside
the range of int, this produces an implementation-defined result that
cannot reliably indicate the direction of overflow.  POSIX requires
strtol() to return exactly LONG_MAX or LONG_MIN on overflow, which
permits safe sign-testing or range-testing.  By analogy, make
strtoint() return INT_MAX or INT_MIN on overflow.

Back-patch, since future bug fixes may expect this behavior.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A33EE17C-D014-4980-B3DD-AC51588A06EC@gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c2d5c09a6b5cdb056954b80e297599fffd3f6c56

Modified Files
--------------
src/common/string.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-10-30 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-30 15:03 pgsql: Return INT_MAX or INT_MIN from strtoint() on overflow. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox