Re: JsonbValue to Jsonb conversion

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: JsonbValue to Jsonb conversion
Date: 2014-10-13 15:03:00
Message-ID: 543BE9A4.1080401@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/13/2014 10:39 AM, Pavel Stehule wrote:
> Hi
>
> A JsonSemAction sem is not well initialized
>
> a array_element_start is not initialized and enforces sigfault on my comp
>
> *** ./utils/adt/jsonb.c.orig 2014-10-13 16:37:00.479708142 +0200
> --- ./utils/adt/jsonb.c 2014-10-13 16:36:33.704650644 +0200
> ***************
> *** 786,791 ****
> --- 786,793 ----
> sem.scalar = jsonb_in_scalar;
> sem.object_field_start =
> jsonb_in_object_field_start;
>
> + sem.array_element_start = NULL;
> +
> pg_parse_json(lex, &sem);
>
> }
>
> I am not sure, if this fix is valid, but all tests are passed now
>
>

Good find. I think what we should probably do is initialize the whole
thing with:

memset(&sem, 0, sizeof(JsonSemAction));

before assigning anything to its fields. That would be consistent with
what we do elsewhere.

I'll make that change and submit a new patch.

Please stop using this thread, however. It's inappropriate for reviewing
this patch.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-10-13 15:10:09 Re: psql output change in 9.4
Previous Message Robert Haas 2014-10-13 15:02:33 Re: [9.4 bug] The database server hangs with write-heavy workload on Windows