Fix possible internal overflow in numeric division.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: cc95595e05c086a53a64eea2b17d135a80548106
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-11-17T20:46:59Z
Releases: 9.4.6
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

Files

PathChange+/−
src/backend/utils/adt/numeric.c modified +9 −3