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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to