aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf64-ppc.c2
-rw-r--r--bfd/elflink.c4
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ldexp.c4
5 files changed, 17 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e71a53a..664a974 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2018-02-01 Simon Marchi <simon.marchi@ericsson.com>
+
+ * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer
+ arithmetic on NULL pointer.
+ * elflink.c (_bfd_elf_archive_symbol_lookup,
+ elf_link_add_archive_symbols): Likewise.
+
2018-01-31 Michael Matz <matz@suse.de>
* elflink.c (bfd_elf_define_start_stop): Fix check of
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 5cbb035..9e4a4b5 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -5051,7 +5051,7 @@ ppc64_elf_archive_symbol_lookup (bfd *abfd,
len = strlen (name);
dot_name = bfd_alloc (abfd, len + 2);
if (dot_name == NULL)
- return (struct elf_link_hash_entry *) 0 - 1;
+ return (struct elf_link_hash_entry *) -1;
dot_name[0] = '.';
memcpy (dot_name + 1, name, len + 1);
h = _bfd_elf_archive_symbol_lookup (abfd, info, dot_name);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 3fe4555..d1eb820 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5422,7 +5422,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abfd,
len = strlen (name);
copy = (char *) bfd_alloc (abfd, len);
if (copy == NULL)
- return (struct elf_link_hash_entry *) 0 - 1;
+ return (struct elf_link_hash_entry *) -1;
first = p - name + 1;
memcpy (copy, name, first);
@@ -5520,7 +5520,7 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
}
h = archive_symbol_lookup (abfd, info, symdef->name);
- if (h == (struct elf_link_hash_entry *) 0 - 1)
+ if (h == (struct elf_link_hash_entry *) -1)
goto error_return;
if (h == NULL)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2db90b5..c1a37c1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-01 Simon Marchi <simon.marchi@ericsson.com>
+
+ * ldexp.c (fold_name, exp_fold_tree_1): Avoid pointer arithmetic
+ on NULL pointer.
+
2018-01-31 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/ld-elf/pr21964-5.c (my_var): Mark as used.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index a097205..bf0df44 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -782,7 +782,7 @@ fold_name (etree_type *tree)
if (expld.assign_src == NULL)
expld.assign_src = h;
else
- expld.assign_src = (struct bfd_link_hash_entry *) 0 - 1;
+ expld.assign_src = (struct bfd_link_hash_entry *) - 1;
}
break;
@@ -1207,7 +1207,7 @@ exp_fold_tree_1 (etree_type *tree)
false branches.) */
if (expld.assign_src != NULL
&& (expld.assign_src
- != (struct bfd_link_hash_entry *) 0 - 1))
+ != (struct bfd_link_hash_entry *) -1))
bfd_copy_link_hash_symbol_type (link_info.output_bfd, h,
expld.assign_src);
}