pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix possible internal overflow in numeric multiplication. 13+ messages / 1 participants [nested] [flat]
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/3dfffac701cf95e3d9b86f12a3875f9b1b531231 Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/246693e5ae8a36f015294aa8c73dbbf0d4e542a8 Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/8b75e489a48cc7ad61cd723180652e6fc1977911 Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/844486216eeb5b483c7b45c13b05dce76387c69a Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/5f79730ec0f015e3168e822ee25554cff5fbe070 Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/fa9fc3a1b8069c0ab5edcd6f8b0caf679fed9392 Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric multiplication. @ 2015-09-21 16:13 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-09-21 16:13 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric multiplication. mul_var() postpones propagating carries until it risks overflow in its internal digit array. However, the logic failed to account for the possibility of overflow in the carry propagation step, allowing wrong results to be generated in corner cases. We must slightly reduce the when-to-propagate-carries threshold to avoid that. Discovered and fixed by Dean Rasheed, with small adjustments by me. This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b, so back-patch to all supported branches. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a89781e34725286b675d41f8dfdfa25ade2a277f Modified Files -------------- src/backend/utils/adt/numeric.c | 14 ++++++++++---- src/test/regress/expected/numeric.out | 27 +++++++++++++++++++++++++++ src/test/regress/sql/numeric.sql | 12 ++++++++++++ 3 files changed, 49 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c47bdb3726ba020b6e187e9279014e9a5e4df0d3 Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/728a2ac214d8084cdc471fe18ece8d2699f47814 Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/5f10b7a604c87fc61a2c20a56552301f74c9bd5f Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/80be41979e3ac2b17a4f985ee9249c78e3bafeb6 Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/cc95595e05c086a53a64eea2b17d135a80548106 Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
* pgsql: Fix possible internal overflow in numeric division. @ 2015-11-17 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 13+ messages in thread From: Tom Lane @ 2015-11-17 20:47 UTC (permalink / raw) To: pgsql-committers Fix possible internal overflow in numeric division. div_var_fast() postpones propagating carries in the same way as mul_var(), so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0, namely that the size of the carries has to be accounted for when setting the threshold for executing a carry propagation step. We've not devised a test case illustrating the brokenness, but the required fix seems clear enough. Like the previous fix, back-patch to all active branches. Dean Rasheed Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/7df6dc4056acc477d792bf3bb1a58eb3c1047269 Modified Files -------------- src/backend/utils/adt/numeric.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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] 13+ messages in thread
end of thread, other threads:[~2015-11-17 20:47 UTC | newest] Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-21 16:13 pgsql: Fix possible internal overflow in numeric multiplication. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. Tom Lane <tgl@sss.pgh.pa.us> 2015-11-17 20:47 pgsql: Fix possible internal overflow in numeric division. 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