Re: Fix NULL pointer reference in _outPathTarget() - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Fix NULL pointer reference in _outPathTarget()
Date
Msg-id CAMbWs49z_a=Wy2nizkfE4bX2d9e3bY3e8OKhZhcRofLw_g4k6w@mail.gmail.com
Whole thread Raw
In response to Re: Fix NULL pointer reference in _outPathTarget()  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers

On Thu, Apr 21, 2022 at 12:02 AM Peter Eisentraut <peter.eisentraut@enterprisedb.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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Postgres perl module namespace
Next
From: Michael Paquier
Date:
Subject: Re: Add --{no-,}bypassrls flags to createuser