pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix cidin() to handle values above 2^31 platform-independently. 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6f13a682c86801cfb9ae4f3126888b42f3cb5c46 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/cb6ab91797b98d1498adcea906fbddffec8c8f9c Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/219d476d8a8b720a034c6b21c5782c6fc20f5bf8 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/ad8cd4baa3a451887b22b104b2dc2f53133537d4 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/ff5ef6add448a180909f1c45151b0aa9929982d9 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/eb338c1cd5347b428725c8d7a79769640c2e10d3 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix cidin() to handle values above 2^31 platform-independently. @ 2016-10-18 16:25 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2016-10-18 16:25 UTC (permalink / raw) To: pgsql-committers Fix cidin() to handle values above 2^31 platform-independently. CommandId is declared as uint32, and values up to 4G are indeed legal. cidout() handles them properly by treating the value as unsigned int. But cidin() was just using atoi(), which has platform-dependent behavior for values outside the range of signed int, as reported by Bart Lengkeek in bug #14379. Use strtoul() instead, as xidin() does. In passing, make some purely cosmetic changes to make xidin/xidout look more like cidin/cidout; the former didn't have a monopoly on best practice IMO. Neither xidin nor cidin make any attempt to throw error for invalid input. I didn't change that here, and am not sure it's worth worrying about since neither is really a user-facing type. The point is just to ensure that indubitably-valid inputs work as expected. It's been like this for a long time, so back-patch to all supported branches. Report: <20161018152550.1413.6439@wrigleys.postgresql.org> Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/2e515559dd8c12f94eecb2831b78e2906a9f77e4 Modified Files -------------- src/backend/utils/adt/xid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2016-10-18 16:25 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-18 16:25 pgsql: Fix cidin() to handle values above 2^31 platform-independently. 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