Re: puzzling JSON bug

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: puzzling JSON bug
Date: 2013-04-04 19:47:09
Message-ID: 515DD8BD.5050502@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 04/04/2013 03:39 PM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> David Wheeler has presented me with a nasty bug case.
>> If I do this:
>> select '{"members": { "add": [3, 4]}}'::json #> '{members,add}';
>> then I get a crash.
>> If I comment out the pfree() at json.c:parse_object_field() lines 378-9
>> then I get back the right result but instead get a warning like this:
>> WARNING: problem in alloc set ExprContext: bogus aset link in block
>> 0x1efaa80, chunk 0x1efb1f0
>> I'm not quite sure where I should go looking for what I've done wrong here.
> Routine array-overrun memory stomp. The chunk header data for "fname"'s
> alloc chunk is being overwritten here:
>
> Watchpoint 2: *(int *) 1075253088
>
> Old value = 1074925616
> New value = -1
> 0x50fe14 in get_array_start (state=0x40170e88) at jsonfuncs.c:688
> 688 _state->array_level_index[lex_level] = -1;
>
> It appears that lex_level is 2 but only enough room for 2 entries has
> been allocated in array_level_index[].

OK, many thanks, will fix.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2013-04-04 19:59:36 Re: corrupt pages detected by enabling checksums
Previous Message Tom Lane 2013-04-04 19:39:23 Re: puzzling JSON bug