pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: nicola75ss <nicola75ss@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #5993: pg_size_pretty overflow
Date: Sun, 24 Apr 2011 18:17:50 GMT
Message-ID: <201104241817.p3OIHoZk039649@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      5993
Logged by:          nicola75ss
Email address:      nicola75ss@gmail.com
PostgreSQL version: 8.4
Operating system:   windows 7
Description:        pg_size_pretty overflow
Details: 

Good morning. I'm totally newbie with postgresql. I was studying
pg_size_pretty() and I've discovered that if I pass it a great value it
returns negative value.

This is an example

select pg_size_pretty(9223372000000000000); -- "-8388607 TB"

I've asked on stackoverflow

http://stackoverflow.com/questions/5768097/why-does-pg-size-pretty-return-ne
gative-value

and users suggest me to report this as a bug.
They say that the problem in the source code is here

else
  {
                     mult *= 1024;
                     snprintf(buf, sizeof(buf), INT64_FORMAT " TB",
                              (size + mult / 2) / mult); /* OVERFLOW! */
                 }
Regards. Nicola Cossu



view thread (2+ messages)  latest in thread

Message-ID: <201104241817.p3OIHoZk039649@wwwmaster.postgresql.org>
Permalink:  ../201104241817.p3OIHoZk039649@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201104241817.p3OIHoZk039649@wwwmaster.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: nicola75ss@gmail.com
  Subject: Re: BUG #5993: pg_size_pretty overflow
  In-Reply-To: <201104241817.p3OIHoZk039649@wwwmaster.postgresql.org>
  References: <201104241817.p3OIHoZk039649@wwwmaster.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