[RFC] Fix PR 16910: Relocate symbol correctly if it is wrapped
Yao Qi
yao@codesourcery.com
Wed Jun 11 06:59:00 GMT 2014
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 (é½å°§)
More information about the Binutils
mailing list