GNU Binutils with patches for OS216
修訂 | 68807c3cd64ccc4f0e9261df3e840d30d9a19b51 (tree) |
---|---|
時間 | 2018-02-07 01:05:13 |
作者 | Nick Clifton <nickc@redh...> |
Commiter | Nick Clifton |
Replace reachable assertion with a test and return of NULL.
PR 22793
* readelf.c (find_section): Replace assertion with test and return
of NULL.
(find_section_by_address): Add test of section header table
existance.
(find_section_by_type): Likewise.
(find_section_in_set): Likewise.
@@ -1,3 +1,13 @@ | ||
1 | +2018-02-06 Nick Clifton <nickc@redhat.com> | |
2 | + | |
3 | + PR 22793 | |
4 | + * readelf.c (find_section): Replace assertion with test and return | |
5 | + of NULL. | |
6 | + (find_section_by_address): Add test of section header table | |
7 | + existance. | |
8 | + (find_section_by_type): Likewise. | |
9 | + (find_section_in_set): Likewise. | |
10 | + | |
1 | 11 | 2018-02-05 Maciej W. Rozycki <macro@mips.com> |
2 | 12 | |
3 | 13 | * testsuite/binutils-all/mips/mips-reginfo.d: New test. |
@@ -655,7 +655,8 @@ find_section (Filedata * filedata, const char * name) | ||
655 | 655 | { |
656 | 656 | unsigned int i; |
657 | 657 | |
658 | - assert (filedata->section_headers != NULL); | |
658 | + if (filedata->section_headers == NULL) | |
659 | + return NULL; | |
659 | 660 | |
660 | 661 | for (i = 0; i < filedata->file_header.e_shnum; i++) |
661 | 662 | if (streq (SECTION_NAME (filedata->section_headers + i), name)) |
@@ -672,6 +673,9 @@ find_section_by_address (Filedata * filedata, bfd_vma addr) | ||
672 | 673 | { |
673 | 674 | unsigned int i; |
674 | 675 | |
676 | + if (filedata->section_headers == NULL) | |
677 | + return NULL; | |
678 | + | |
675 | 679 | for (i = 0; i < filedata->file_header.e_shnum; i++) |
676 | 680 | { |
677 | 681 | Elf_Internal_Shdr *sec = filedata->section_headers + i; |
@@ -688,6 +692,9 @@ find_section_by_type (Filedata * filedata, unsigned int type) | ||
688 | 692 | { |
689 | 693 | unsigned int i; |
690 | 694 | |
695 | + if (filedata->section_headers == NULL) | |
696 | + return NULL; | |
697 | + | |
691 | 698 | for (i = 0; i < filedata->file_header.e_shnum; i++) |
692 | 699 | { |
693 | 700 | Elf_Internal_Shdr *sec = filedata->section_headers + i; |
@@ -707,6 +714,9 @@ find_section_in_set (Filedata * filedata, const char * name, unsigned int * set) | ||
707 | 714 | { |
708 | 715 | unsigned int i; |
709 | 716 | |
717 | + if (filedata->section_headers == NULL) | |
718 | + return NULL; | |
719 | + | |
710 | 720 | if (set != NULL) |
711 | 721 | { |
712 | 722 | while ((i = *set++) > 0) |