Re: BUG #1671: Long interval string representation rejected

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Mark Dilger <markdilger(at)yahoo(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1671: Long interval string representation rejected
Date: 2005-05-24 06:45:26
Message-ID: 4292CD86.20601@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> I'm not set on it --- fix it as you suggested.

Attached is a patch that implements this. I'm not especially happy about
the implementation: defining _two_ local macros (that both
doubly-evaluate one of their arguments) is pretty ugly, but I didn't see
a cleaner alternative -- suggestions welcome.

This patch fixes the stack overrun. Since we now pass the length of the
working space into ParseDateTime(), it is also easy to fix Mark's bug: I
just increased the size of the interval_in() working buffer to 256
bytes. I didn't touch any of the other input buffer sizes, although that
shouldn't be taken as a vote of confidence that they are correct :) At
least the consequence of an insufficiently-large buffer is limited to
rejecting otherwise valid input, rather than potentially scribbling on
the stack.

-Neil

Attachment Content-Type Size
datetime_parsing-3.patch text/x-patch 19.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Russell Smith 2005-05-24 08:56:22 Re: BUG #1677: Bug in select with Union
Previous Message Bruce Momjian 2005-05-24 04:16:38 Re: [BUGS] BUG #1609: Bug in interval datatype for 64 Bit timestamps