pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Guard against division by zero in test_int128 module.
Date: Sat, 25 Oct 2025 10:11:16 +0000
Message-ID: <E1vCbEy-003QP1-0n@gemulon.postgresql.org> (raw)

Guard against division by zero in test_int128 module.

When testing 128/32-bit division in the test_int128 test module, make
sure that we don't attempt to divide by zero.

While at it, use pg_prng_int64() and pg_prng_int32() to generate the
random numbers required for the tests, rather than pg_prng_uint64().
This eliminates the need for any implicit or explicit type casts.

Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/da4wqngd6gwz5s4yf5y5f75xj7gpja62l4dbp6w4j3vs7fcjue@upvolcu4e6o2

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7e2af1fb1118a547bd831fca3afbc3ff80ebf089

Modified Files
--------------
src/test/modules/test_int128/test_int128.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)



Message-ID: <E1vCbEy-003QP1-0n@gemulon.postgresql.org>
Permalink:  ../E1vCbEy-003QP1-0n@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vCbEy-003QP1-0n@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Guard against division by zero in test_int128 module.
  In-Reply-To: <E1vCbEy-003QP1-0n@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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