Re: BUG #16953: OOB access while converting "interval" to char

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #16953: OOB access while converting "interval" to char
Дата
Msg-id YHAza+N74LHygGnB@paquier.xyz
обсуждение исходный текст
Ответ на Re: BUG #16953: OOB access while converting "interval" to char  (Julien Rouhaud <rjuju123@gmail.com>)
Ответы Re: BUG #16953: OOB access while converting "interval" to char  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
On Fri, Apr 09, 2021 at 06:42:46PM +0800, Julien Rouhaud wrote:
> I'm not sure what you mean by that.  We receive a pg_tm struct which can't
> contain more than 12 in tm_mon right?  And actually for intervals it will
> reduce "12 months" to "1 year 0 month", so to_char previously didn't report
> anything for 12 months either.

I did not take the time to look in details, but for reference I just
imagined that a formula like this one would give pretty much the
position in rm_months_upper:
M_PER_Y - ((tm_mon % M_PER_Y) + M_PER_Y) % M_PER_Y

> Hearing no other opinion I went with -1 -> december and so on in attached v2.
> I also fixed the "[-]12 months" case and updated the regression tests.  Given
> the extra code needed to deduce the correct array position I factorized DCH_RM
> and DCH_rm.

Yep.  The regression tests show what I would expect.  I'll check in
details later.
--
Michael

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: BUG #16953: OOB access while converting "interval" to char
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16957: initdb.exe initialize a database cluster has stopped working