Re: Report a potential bug caused by a improper call to pfree()

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: rjuju123(at)gmail(dot)com, wliang(at)stu(dot)xidian(dot)edu(dot)cn, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Report a potential bug caused by a improper call to pfree()
Date: 2022-01-31 02:41:44
Message-ID: 20220131.114144.1534169725851050672.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

At Sun, 30 Jan 2022 10:29:27 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in
> Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> > On Sun, Jan 30, 2022 at 10:47:18AM +0800, wliang(at)stu(dot)xidian(dot)edu(dot)cn wrote:
> >> 1160 /* Pop the stack */
> >> 1161 parent = stack->parent;
> >> 1162 pfree(stack);
> >>
> >> I think it may be a potential bug and can be fixed without any side-effect as:
> >>
> >>
> >> ++ if (stack != &tail)
> >> 1162 pfree(stack);
>
> > I don't think it's necessary, it should be guaranteed that something as been
> > pushed on the tail, ie. there shouldn't be a WJB_END_* before a corresponding
> > begin.
>
> I've not checked the logic, but the lack of any reported crashes here
> seems to confirm that there's no bug.

As a cross-check, I agree to Julien. The parser starts reading from
OBJECT_START or ARRAY_START (or bare scalar) so if we had the stack
empty there, we *should properly crash* instead of pretending that a
problem were not exitsting at all.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-01-31 08:44:13 BUG #17388: postgis cant be installed on postgres 11 and centos 7
Previous Message Tom Lane 2022-01-30 18:38:40 Re: Missing include in float.h