Re: jsonb crash

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb crash
Date: 2021-09-29 19:16:44
Message-ID: CAEudQArythrpiQajjowy+UFBONaVB+85JoXZ5zj1BESYhSna4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 29 de set. de 2021 às 15:55, Jaime Casanova <
jcasanov(at)systemguards(dot)com(dot)ec> escreveu:

> Hi,
>
> I found a crash (segmentation fault) on jsonb.
> This is the best I could do to reduce the query:
>
> """
> select
> 75 as c1
> from
> public.pagg_tab_ml as ref_0,
> lateral (select
> ref_0.a as c5
> from generate_series(1, 300) as sample_0
> fetch first 78 rows only
> ) as subq_0
> where case when (subq_0.c5 < 2)
> then cast(null as jsonb)
> else cast(null as jsonb)
> end ? ref_0.c
> """
>
> And because it needs pagg_tab_ml it should be run a regression database.
> This affects at least 14 and 15.
>
> Attached is the backtrace.
>
Yeah, Coverity has a report about this at function:

JsonbValue *
pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
JsonbValue *jbval)

1. CID undefined: Dereference after null check (FORWARD_NULL)
return pushJsonbValueScalar(pstate, seq, jbval);

2. CID undefined (#1 of 1): Dereference after null check (FORWARD_NULL)16.
var_deref_model:
Passing pstate to pushJsonbValueScalar, which dereferences null *pstate

res = pushJsonbValueScalar(pstate, tok,
tok <
WJB_BEGIN_ARRAY ||
(tok ==
WJB_BEGIN_ARRAY &&
v.
val.array.rawScalar) ? &v : NULL);

regards,
Ranier Vilela

In response to

  • jsonb crash at 2021-09-29 18:55:44 from Jaime Casanova

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-09-29 19:36:11 Re: Empty string in lexeme for tsvector
Previous Message Jaime Casanova 2021-09-29 18:55:44 jsonb crash