Re: to_timestamp not stable if date string shorter than

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Stacy White <harsh(at)computer(dot)org>, pgsql-bugs(at)postgresql(dot)org, Aaron Harsh <ajh(at)rentrak(dot)com>, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: to_timestamp not stable if date string shorter than
Date: 2003-09-03 04:15:47
Message-ID: 6946.1062562547@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> Replying to myself again:
> In DCH_processor (formatting.c), it doesn't seem to stop if it's in the
> middle of processing nodes but runs off the inout string, should the for
> loop be something like:
> for (n=node,s=inout;n->type!=NODE_TYPE_END && *s!='\0';++n,++s) {
> and get rid of the ++s at the bottom of the loop for safety?

That wouldn't change the behavior, would it?

The code is definitely running off the end of the input string. I am
tempted to suggest that the "++s" at the bottom of the loop should
become
if (*s)
++s;
but I'm not sure enough of the intentions of this code to recommend
that as a full fix. Karel, the ball's in your court ...

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2003-09-03 04:33:11 Re: to_timestamp not stable if date string shorter than
Previous Message Tom Lane 2003-09-03 04:03:59 Re: to_timestamp not stable if date string shorter than

Browse pgsql-patches by date

  From Date Subject
Next Message Stephan Szabo 2003-09-03 04:33:11 Re: to_timestamp not stable if date string shorter than
Previous Message Stephan Szabo 2003-09-03 02:03:56 Re: to_timestamp not stable if date string shorter than