Re: Fix NULL pointer reference in _outPathTarget()

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix NULL pointer reference in _outPathTarget()
Date: 2022-04-21 04:25:11
Message-ID: CAMbWs49z_a=Wy2nizkfE4bX2d9e3bY3e8OKhZhcRofLw_g4k6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 21, 2022 at 12:02 AM Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:

> On 18.04.22 09:35, Richard Guo wrote:
> > The array sortgrouprefs[] inside PathTarget might be NULL if we have not
> > identified sort/group columns in this tlist. In that case we would have
> > a NULL pointer reference in _outPathTarget() when trying to print
> > sortgrouprefs[] with WRITE_INDEX_ARRAY as we are using the length of
> > PathTarget->exprs as its array length.
>
> Do you have a test case that triggers this issue?
>

I don't have a test case. :( I triggered this issue while debugging
with gdb and I was printing a certain 'pathlist' with nodeToString().

If it helps, here is the backtrace:

#0 in _outPathTarget (str=0x7fff683d7e50, node=0x56011e5cece0) at
outfuncs.c:2672
#1 in outNode (str=0x7fff683d7e50, obj=0x56011e5cece0) at outfuncs.c:4490
#2 in _outPathInfo (str=0x7fff683d7e50, node=0x56011e5f3408) at
outfuncs.c:1922
#3 in _outPath (str=0x7fff683d7e50, node=0x56011e5f3408) at outfuncs.c:1957
#4 in outNode (str=0x7fff683d7e50, obj=0x56011e5f3408) at outfuncs.c:4358
#5 in _outProjectionPath (str=0x7fff683d7e50, node=0x56011e5f3890) at
outfuncs.c:2154
#6 in outNode (str=0x7fff683d7e50, obj=0x56011e5f3890) at outfuncs.c:4409
#7 in _outAggPath (str=0x7fff683d7e50, node=0x56011e5f4550) at
outfuncs.c:2224
#8 in outNode (str=0x7fff683d7e50, obj=0x56011e5f4550) at outfuncs.c:4427
#9 in _outGatherPath (str=0x7fff683d7e50, node=0x56011e5f45e8) at
outfuncs.c:2142
#10 in outNode (str=0x7fff683d7e50, obj=0x56011e5f45e8) at outfuncs.c:4406
#11 in _outList (str=0x7fff683d7e50, node=0x56011e5f4680) at outfuncs.c:227
#12 in outNode (str=0x7fff683d7e50, obj=0x56011e5f4680) at outfuncs.c:4028
#13 in nodeToString (obj=0x56011e5f4680) at outfuncs.c:4782

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-04-21 04:29:57 Re: Add --{no-,}bypassrls flags to createuser
Previous Message Michael Paquier 2022-04-21 04:11:49 Re: Postgres perl module namespace