• Tom Lane's avatar
    Fix possible internal overflow in numeric multiplication. · 246693e5
    Tom Lane authored
    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 d72f6c75,
    so back-patch to all supported branches.
    246693e5
numeric.out 64.1 KB