This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: creating the gdb-7.4 branch tomorrow (?)


Tom Tromey <tromey@redhat.com> writes:

> +static void
> +filter_sals (struct symtabs_and_lines *sals)
> +{
> +  int i, out, prev;
> +
> +  out = 0;
> +  for (i = 0; i < sals->nelts; ++i)
> +    {
> +      if (sals->sals[i].pspace == current_program_space
> +	  || sals->sals[i].symtab == NULL)
> +	{
> +	  sals->sals[out] = sals->sals[i];
> +	  ++out;
> +	}
> +    }
> +  sals->nelts = out;
> +
> +  qsort (sals->sals, sals->nelts, sizeof (struct symtab_and_line),
> +	 compare_symtabs);
> +
> +  out = 1;
> +  prev = 0;
> +  for (i = 1; i < sals->nelts; ++i)
> +    {
> +      if (compare_symtabs (&sals->sals[prev], &sals->sals[i]))
> +	{
> +	  /* Symtabs differ.  */
> +	  sals->sals[out] = sals->sals[i];
> +	  prev = out;
> +	  ++out;
> +	}
> +    }
> +  sals->nelts = out;
> +
> +  if (sals->nelts == 0)

This is never true.  If sals->nelts == 0 on entry then it will always be
set to 1, causing the caller to crash when dereferencing sals->sals.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]