bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-indent] Re: Bug#206785: Fixed: Bug#206785: indent segfaults on the


From: Santiago Vila
Subject: [Bug-indent] Re: Bug#206785: Fixed: Bug#206785: indent segfaults on the attached file
Date: Tue, 23 Sep 2003 15:32:05 +0200 (CEST)

On Tue, 23 Sep 2003, Erik de Castro Lopo wrote:

> HI all,
>
> I love it when they are this easy :-).
>
> Basically, the code did have checking for the end of the buffer in a few
> places, but did not have it inside an inner loop. This patch fixes that.
>
> diff -r -c indent-2.2.9/src/indent.c indent-2.2.9-fix-segfault/src/indent.c
> *** indent-2.2.9/src/indent.c Tue Oct 29 07:00:56 2002
> --- indent-2.2.9-fix-segfault/src/indent.c    Tue Sep 23 22:04:24 2003
> ***************
> *** 875,880 ****
> --- 875,882 ----
>                                                    * imply we are in a stmt */
>           for (t_ptr = s_code; *t_ptr; ++t_ptr)
>           {
> +             if (e_lab >= l_lab)
> +                 check_lab_size ();
>               *e_lab++ = *t_ptr;  /* turn everything so far into a label */
>           }
>

You probably mean this:

diff -ru indent-2.2.9.orig/src/indent.c indent-2.2.9/src/indent.c
--- indent-2.2.9.orig/src/indent.c      Tue Sep 23 15:24:10 2003
+++ indent-2.2.9/src/indent.c   Tue Sep 23 15:26:17 2003
@@ -875,6 +875,7 @@
                                                  * imply we are in a stmt */
         for (t_ptr = s_code; *t_ptr; ++t_ptr)
         {
+            check_lab_size();
             *e_lab++ = *t_ptr;  /* turn everything so far into a label */
         }

since check_lab_size() already checks that e_lab >= l_lab :-)

Thanks a lot, I'll apply this patch very soon.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]