Re: Zero-padding and zero-masking fixes for to_char(float) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Zero-padding and zero-masking fixes for to_char(float)
Date
Msg-id 20150322014624.GD10795@momjian.us
Whole thread Raw
In response to Zero-padding and zero-masking fixes for to_char(float)  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Zero-padding and zero-masking fixes for to_char(float)
List pgsql-hackers
On Wed, Mar 18, 2015 at 05:52:44PM -0400, Bruce Momjian wrote:
> In September, while researching the to_char() buffer overflow bugs fixed
> in 9.4.1 (commit 0150ab567bcf5e5913e2b62a1678f84cc272441f), I found an
> inconsistency in how to_char() does zero-padding for float4/8 values. 
> Now that 9.4.1 is released and I am home for a while, I am ready to
> address this.
...
> float4/8 are padding to the internal precision, while int4/numeric are
> padding based on the requested precision.  This is inconsistent.
> 
> The first attached patch fixes this, and also zeros the "junk" digits
> which exceed the precision of the underlying type:

Patch applied.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: PATCH: numeric timestamp in log_line_prefix
Next
From: Bruce Momjian
Date:
Subject: Re: PATCH: numeric timestamp in log_line_prefix