Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
| От | Tom Lane |
|---|---|
| Тема | Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.) |
| Дата | |
| Msg-id | 322.1495328415@sss.pgh.pa.us обсуждение |
| Ответ на | Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.) (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventivemaintenance in advance of pgindent run.)
|
| Список | pgsql-hackers |
I wrote:
> Also, I found two places where an overlength comment line is simply busted
> altogether --- notice that a character is missing at the split point:
I found the cause of that: you need to apply this patch:
--- freebsd_indent/pr_comment.c~ 2017-05-17 14:59:31.548442801 -0400
+++ freebsd_indent/pr_comment.c 2017-05-20 20:51:16.447332977 -0400
@@ -344,8 +353,8 @@ pr_comment(void) { int len = strlen(t_ptr);
- CHECK_SIZE_COM(len);
- memmove(e_com, t_ptr, len);
+ CHECK_SIZE_COM(len + 1);
+ memmove(e_com, t_ptr, len + 1); last_bl = strpbrk(e_com, " \t"); e_com += len;
}
As the code stands, the strpbrk call is being applied to a
not-null-terminated string and therefore is sometimes producing an
insane value of last_bl, messing up decisions later in the comment.
Having the memmove include the trailing \0 resolves that.
regards, tom lane
В списке pgsql-hackers по дате отправления: