Re: to_timestamp not stable if date string shorter than - Mailing list pgsql-bugs

From Tom Lane
Subject Re: to_timestamp not stable if date string shorter than
Date
Msg-id 6946.1062562547@sss.pgh.pa.us
Whole thread Raw
In response to Re: to_timestamp not stable if date string shorter than  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: to_timestamp not stable if date string shorter than
List pgsql-bugs
Stephan Szabo <sszabo@megazone.bigpanda.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: to_timestamp not stable if date string shorter than
Next
From: Stephan Szabo
Date:
Subject: Re: to_timestamp not stable if date string shorter than