This isn't actually a live bug, as the output happens to be the
same. But it upsets tools like UBSan, which makes it worthwhile to
fix.
As it's an issue without practical consequences, don't backpatch.
Author: Andres Freund
Discussion: https://postgr.es/m/
20180928001121.hhx5n6dsygqxr5wu@alap3.anarazel.de
PrintfTarget *target)
{
unsigned long long base;
+ unsigned long long uvalue;
int dosign;
const char *cvt = "0123456789abcdef";
int signvalue = 0;
/* Handle +/- */
if (dosign && adjust_sign((value < 0), forcesign, &signvalue))
- value = -value;
+ uvalue = -(uint64) value;
+ else
+ uvalue = (uint64) value;
/*
* SUS: the result of converting 0 with an explicit precision of 0 is no
else
{
/* make integer string */
- unsigned long long uvalue = (unsigned long long) value;
-
do
{
convert[sizeof(convert) - (++vallen)] = cvt[uvalue % base];