Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] symtab.c: make sure alloca is big enough
@ 2001-12-03 11:31 Michael Snyder
  2001-12-05  5:47 ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2001-12-03 11:31 UTC (permalink / raw)
  To: gdb-patches

2001-12-03  Michael Snyder  <msnyder@redhat.com>

	* symtab.c (search_symbols): Make sure alloca size is big enough.

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 symtab.c
*** symtab.c	2001/11/13 16:42:50	1.48
--- symtab.c	2001/12/03 19:28:26
*************** search_symbols (char *regexp, namespace_
*** 2422,2428 ****
  	  /* If wrong number of spaces, fix it. */
  	  if (fix >= 0)
  	    {
! 	      char *tmp = (char *) alloca (strlen (regexp) + fix);
  	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
  	      regexp = tmp;
  	    }
--- 2422,2428 ----
  	  /* If wrong number of spaces, fix it. */
  	  if (fix >= 0)
  	    {
! 	      char *tmp = (char *) alloca (8 + fix + strlen (opname) + 1);
  	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
  	      regexp = tmp;
  	    }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] symtab.c: make sure alloca is big enough
  2001-12-03 11:31 [PATCH] symtab.c: make sure alloca is big enough Michael Snyder
@ 2001-12-05  5:47 ` Elena Zannoni
  2001-12-05  5:59   ` Elena Zannoni
  2001-12-05 12:05   ` Michael Snyder
  0 siblings, 2 replies; 4+ messages in thread
From: Elena Zannoni @ 2001-12-05  5:47 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

Michael Snyder writes:
 > 2001-12-03  Michael Snyder  <msnyder@redhat.com>
 > 
 > 	* symtab.c (search_symbols): Make sure alloca size is big enough.

Michael,
have you checked this in? If not please do.

Where would this problem manifest itself?
Some testsuite cases?

Thanks
Elena


 > 
 > Index: symtab.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.c,v
 > retrieving revision 1.48
 > diff -c -3 -p -r1.48 symtab.c
 > *** symtab.c	2001/11/13 16:42:50	1.48
 > --- symtab.c	2001/12/03 19:28:26
 > *************** search_symbols (char *regexp, namespace_
 > *** 2422,2428 ****
 >   	  /* If wrong number of spaces, fix it. */
 >   	  if (fix >= 0)
 >   	    {
 > ! 	      char *tmp = (char *) alloca (strlen (regexp) + fix);
 >   	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
 >   	      regexp = tmp;
 >   	    }
 > --- 2422,2428 ----
 >   	  /* If wrong number of spaces, fix it. */
 >   	  if (fix >= 0)
 >   	    {
 > ! 	      char *tmp = (char *) alloca (8 + fix + strlen (opname) + 1);
 >   	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
 >   	      regexp = tmp;
 >   	    }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] symtab.c: make sure alloca is big enough
  2001-12-05  5:47 ` Elena Zannoni
@ 2001-12-05  5:59   ` Elena Zannoni
  2001-12-05 12:05   ` Michael Snyder
  1 sibling, 0 replies; 4+ messages in thread
From: Elena Zannoni @ 2001-12-05  5:59 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

Elena Zannoni writes:
 > Michael Snyder writes:
 >  > 2001-12-03  Michael Snyder  <msnyder@redhat.com>
 >  > 
 >  > 	* symtab.c (search_symbols): Make sure alloca size is big enough.
 > 
 > Michael,
 > have you checked this in? If not please do.
 > 
 > Where would this problem manifest itself?
 > Some testsuite cases?
 > 
 > Thanks
 > Elena
 > 
 > 


Never mind, I see this is already in. 

Elena


 >  > 
 >  > Index: symtab.c
 >  > ===================================================================
 >  > RCS file: /cvs/src/src/gdb/symtab.c,v
 >  > retrieving revision 1.48
 >  > diff -c -3 -p -r1.48 symtab.c
 >  > *** symtab.c	2001/11/13 16:42:50	1.48
 >  > --- symtab.c	2001/12/03 19:28:26
 >  > *************** search_symbols (char *regexp, namespace_
 >  > *** 2422,2428 ****
 >  >   	  /* If wrong number of spaces, fix it. */
 >  >   	  if (fix >= 0)
 >  >   	    {
 >  > ! 	      char *tmp = (char *) alloca (strlen (regexp) + fix);
 >  >   	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
 >  >   	      regexp = tmp;
 >  >   	    }
 >  > --- 2422,2428 ----
 >  >   	  /* If wrong number of spaces, fix it. */
 >  >   	  if (fix >= 0)
 >  >   	    {
 >  > ! 	      char *tmp = (char *) alloca (8 + fix + strlen (opname) + 1);
 >  >   	      sprintf (tmp, "operator%.*s%s", fix, " ", opname);
 >  >   	      regexp = tmp;
 >  >   	    }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] symtab.c: make sure alloca is big enough
  2001-12-05  5:47 ` Elena Zannoni
  2001-12-05  5:59   ` Elena Zannoni
@ 2001-12-05 12:05   ` Michael Snyder
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2001-12-05 12:05 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

Elena Zannoni wrote:
> 
> Michael Snyder writes:
>  > 2001-12-03  Michael Snyder  <msnyder@redhat.com>
>  >
>  >      * symtab.c (search_symbols): Make sure alloca size is big enough.
> 
> Michael,
> have you checked this in? If not please do.
> 
> Where would this problem manifest itself?
> Some testsuite cases?

It probably would not manifest itself at all.  This is a 
paranoia fix, based on feedback from Michael Chastain.
He pointed out that, although the previous allocation size
was probably big enough, it was not provably big enough.
The new size can be easily demonstrated to be big enough
(by inspection, as it were).

 
> Thanks
> Elena
> 
>  >
>  > Index: symtab.c
>  > ===================================================================
>  > RCS file: /cvs/src/src/gdb/symtab.c,v
>  > retrieving revision 1.48
>  > diff -c -3 -p -r1.48 symtab.c
>  > *** symtab.c 2001/11/13 16:42:50     1.48
>  > --- symtab.c 2001/12/03 19:28:26
>  > *************** search_symbols (char *regexp, namespace_
>  > *** 2422,2428 ****
>  >        /* If wrong number of spaces, fix it. */
>  >        if (fix >= 0)
>  >          {
>  > !          char *tmp = (char *) alloca (strlen (regexp) + fix);
>  >            sprintf (tmp, "operator%.*s%s", fix, " ", opname);
>  >            regexp = tmp;
>  >          }
>  > --- 2422,2428 ----
>  >        /* If wrong number of spaces, fix it. */
>  >        if (fix >= 0)
>  >          {
>  > !          char *tmp = (char *) alloca (8 + fix + strlen (opname) + 1);
>  >            sprintf (tmp, "operator%.*s%s", fix, " ", opname);
>  >            regexp = tmp;
>  >          }


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-05 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-03 11:31 [PATCH] symtab.c: make sure alloca is big enough Michael Snyder
2001-12-05  5:47 ` Elena Zannoni
2001-12-05  5:59   ` Elena Zannoni
2001-12-05 12:05   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox