pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix NUMERIC field access macros to treat NaNs consistently. 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix NUMERIC field access macros to treat NaNs consistently. @ 2015-01-27 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-01-27 17:07 UTC (permalink / raw) To: pgsql-committers Fix NUMERIC field access macros to treat NaNs consistently. Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric NaN values as short-header numerics, but the field access macros did not get the memo: they thought only "SHORT" numerics have short headers. Most of the time this makes no difference because we don't access the weight or dscale of a NaN; but numeric_send does that. As pointed out by Andrew Gierth, this led to fetching uninitialized bytes. AFAICS this could not have any worse consequences than that; in particular, an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC, so that there's no risk of a fetch off the end of memory. Still, the code is wrong on its own terms, and it's not hard to foresee future changes that might expose us to real risks. So back-patch to all affected branches. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/1a2b2034d48d46ec3d128b167cb7df317b4cd49a Modified Files -------------- src/backend/utils/adt/numeric.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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] 5+ messages in thread
* pgsql: Fix NUMERIC field access macros to treat NaNs consistently. @ 2015-01-27 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-01-27 17:07 UTC (permalink / raw) To: pgsql-committers Fix NUMERIC field access macros to treat NaNs consistently. Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric NaN values as short-header numerics, but the field access macros did not get the memo: they thought only "SHORT" numerics have short headers. Most of the time this makes no difference because we don't access the weight or dscale of a NaN; but numeric_send does that. As pointed out by Andrew Gierth, this led to fetching uninitialized bytes. AFAICS this could not have any worse consequences than that; in particular, an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC, so that there's no risk of a fetch off the end of memory. Still, the code is wrong on its own terms, and it's not hard to foresee future changes that might expose us to real risks. So back-patch to all affected branches. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/3d5e857ab1ed7dbac28e6c0aea580d1dfb9dc9ed Modified Files -------------- src/backend/utils/adt/numeric.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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] 5+ messages in thread
* pgsql: Fix NUMERIC field access macros to treat NaNs consistently. @ 2015-01-27 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-01-27 17:07 UTC (permalink / raw) To: pgsql-committers Fix NUMERIC field access macros to treat NaNs consistently. Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric NaN values as short-header numerics, but the field access macros did not get the memo: they thought only "SHORT" numerics have short headers. Most of the time this makes no difference because we don't access the weight or dscale of a NaN; but numeric_send does that. As pointed out by Andrew Gierth, this led to fetching uninitialized bytes. AFAICS this could not have any worse consequences than that; in particular, an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC, so that there's no risk of a fetch off the end of memory. Still, the code is wrong on its own terms, and it's not hard to foresee future changes that might expose us to real risks. So back-patch to all affected branches. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/78f79b66990d5fc469dcf370d8fa4cc91f87cc85 Modified Files -------------- src/backend/utils/adt/numeric.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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] 5+ messages in thread
* pgsql: Fix NUMERIC field access macros to treat NaNs consistently. @ 2015-01-27 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-01-27 17:07 UTC (permalink / raw) To: pgsql-committers Fix NUMERIC field access macros to treat NaNs consistently. Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric NaN values as short-header numerics, but the field access macros did not get the memo: they thought only "SHORT" numerics have short headers. Most of the time this makes no difference because we don't access the weight or dscale of a NaN; but numeric_send does that. As pointed out by Andrew Gierth, this led to fetching uninitialized bytes. AFAICS this could not have any worse consequences than that; in particular, an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC, so that there's no risk of a fetch off the end of memory. Still, the code is wrong on its own terms, and it's not hard to foresee future changes that might expose us to real risks. So back-patch to all affected branches. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/350f1e7a8c44a7b7dbad3baf31f5a92f4d2974b6 Modified Files -------------- src/backend/utils/adt/numeric.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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] 5+ messages in thread
* pgsql: Fix NUMERIC field access macros to treat NaNs consistently. @ 2015-01-27 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-01-27 17:07 UTC (permalink / raw) To: pgsql-committers Fix NUMERIC field access macros to treat NaNs consistently. Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric NaN values as short-header numerics, but the field access macros did not get the memo: they thought only "SHORT" numerics have short headers. Most of the time this makes no difference because we don't access the weight or dscale of a NaN; but numeric_send does that. As pointed out by Andrew Gierth, this led to fetching uninitialized bytes. AFAICS this could not have any worse consequences than that; in particular, an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC, so that there's no risk of a fetch off the end of memory. Still, the code is wrong on its own terms, and it's not hard to foresee future changes that might expose us to real risks. So back-patch to all affected branches. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/8eb1e9d962b9c960af7b74348b909680d4610dfe Modified Files -------------- src/backend/utils/adt/numeric.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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] 5+ messages in thread
end of thread, other threads:[~2015-01-27 17:07 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-01-27 17:07 pgsql: Fix NUMERIC field access macros to treat NaNs consistently. Tom Lane <tgl@sss.pgh.pa.us> 2015-01-27 17:07 pgsql: Fix NUMERIC field access macros to treat NaNs consistently. Tom Lane <tgl@sss.pgh.pa.us> 2015-01-27 17:07 pgsql: Fix NUMERIC field access macros to treat NaNs consistently. Tom Lane <tgl@sss.pgh.pa.us> 2015-01-27 17:07 pgsql: Fix NUMERIC field access macros to treat NaNs consistently. Tom Lane <tgl@sss.pgh.pa.us> 2015-01-27 17:07 pgsql: Fix NUMERIC field access macros to treat NaNs consistently. 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