pgsql: Use mul_size when multiplying by the number of parallel workers.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use mul_size when multiplying by the number of parallel workers.
Date: 2016-05-06 18:40:43
Message-ID: E1aykg7-00013p-Br@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use mul_size when multiplying by the number of parallel workers.

That way, if the result overflows size_t, you'll get an error instead
of undefined behavior, which seems like a plus. This also has the
effect of casting the number of workers from int to Size, which is
better because it's harder to overflow int than size_t.

Dilip Kumar reported this issue and provided a patch upon which this
patch is based, but his version did use mul_size.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/06bd458cb812623c3f1fdd55216c4c08b06a8447

Modified Files
--------------
src/backend/access/transam/parallel.c | 6 ++++--
src/backend/executor/execParallel.c | 18 +++++++++++-------
2 files changed, 15 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-05-06 18:45:32 pgsql: Improve pg_upgrade's report about failure to match up old and ne
Previous Message Stephen Frost 2016-05-06 18:06:59 pgsql: pg_dump performance and other fixes