Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rekgrpth(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18232: Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY, WJB_VALUE and WJB_ELEM
Date: 2023-12-07 14:30:45
Message-ID: 1267887.1701959445@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> Function pushJsonbValueScalar has not Assert(scalarVal) on WJB_KEY,
> WJB_VALUE and WJB_ELEM
> So I can call pushJsonbValue(NULL, WJB_VALUE, NULL) and get Segmentation
> fault

What's your point? If we did have such Asserts, the process would
still crash if you did that.

In general I don't find a lot of value in Assert'ing that a pointer
isn't null in code that is about to dereference it. You'll get a
clearly-interpretable process crash either way, so an Assert seems
like useless code bloat. Others might have a different opinion,
but surely this is a matter of style not a bug. We've not chosen
to have any particular project style on this point.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-12-07 14:32:43 Re: BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex
Previous Message PG Bug reporting form 2023-12-07 12:49:23 BUG #18233: coerce_type accepts NULL as pstate and can pass it to coerce_record_to_complex