[patch]overallocate memory for curly braces in array_out

From: Keiichi Hirobe <chalenge(dot)akane(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: [patch]overallocate memory for curly braces in array_out
Date: 2018-09-23 11:36:55
Message-ID: CAH=EFxE9W0tRvQkixR2XJRRCToUYUEDkJZk6tnADXugPBRdcdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is a patch that fixes a bug
for miscounting total number of curly braces in output string in array_out.

Example1
{{1,2,3},{4,5,6}} -> dims[0] = 2, dims[1]= 3

- Without the patch
8
- After
3

Example2
N size one-dimensional array -> dims[0] = N

- Without the patch
N
- After
1

I used gdb to confirm the above behavior.

Cheers,
Keiichi Hirobe

Attachment Content-Type Size
array_out_bugfix.patch application/octet-stream 426 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-09-23 13:00:41 Re: Collation versioning
Previous Message Andrey Borodin 2018-09-23 10:15:09 amcheck verification for GiST