pgsql: Fix broken allocation logic in recently-rewritten jsonb_util.c.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix broken allocation logic in recently-rewritten jsonb_util.c.
Date: 2014-05-09 22:24:24
Message-ID: E1WitDM-0007gT-Cq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix broken allocation logic in recently-rewritten jsonb_util.c.

reserveFromBuffer() failed to consider the possibility that it needs to
more-than-double the current buffer size. Beyond that, it seems likely
that we'd someday need to worry about integer overflow of the buffer
length variable. Rather than reinvent the logic that's already been
debugged in stringinfo.c, let's go back to using that logic. We can
still have the same targeted API, but we'll rely on stringinfo.c to
manage reallocation.

Per report from Alexander Korotkov.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3d8c2b496fc1fed2b8ff8a403d3a17329325466e

Modified Files
--------------
src/backend/utils/adt/jsonb_util.c | 78 ++++++++++++++++--------------------
1 file changed, 35 insertions(+), 43 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-05-09 22:32:29 Re: [COMMITTERS] pgsql: Clean up jsonb code.
Previous Message Peter Geoghegan 2014-05-09 22:23:57 Re: [COMMITTERS] pgsql: Clean up jsonb code.