This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [RFC] Fix PR 16910: Relocate symbol correctly if it is wrapped


Alan,
Thanks for your patch.  A question below,

On 06/10/2014 09:36 PM, Alan Modra wrote:
> +  if (*l == bfd_get_symbol_leading_char (input_bfd)
> +      || *l == info->wrap_char)
> +    ++l;  <-------- [1]

> +
> +  if (CONST_STRNEQ (l, WRAP))
> +    {
> +      l += sizeof WRAP - 1;
> +
> +      if (bfd_hash_lookup (info->wrap_hash, l, FALSE, FALSE) != NULL)
> +	{
> +	  char save = 0;
> +	  if (l - sizeof WRAP - 1 != h->root.string)

This is always true, because 'l' is incremented by either
'sizeof WRAP - 1' or 'sizeof WRAP'.  This causes 'l' set incorrectly,
and 'h' is NULL afterwards.  It causes a segmentation
fault in the caller of this function.

What you meant probably is "l - sizeof WRAP + 1 != h->root.string",
in order to check whether 'l' is incremented in [1] or not.

-- 
Yao (éå)


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