• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂68807c3cd64ccc4f0e9261df3e840d30d9a19b51 (tree)
時間2018-02-07 01:05:13
作者Nick Clifton <nickc@redh...>
CommiterNick Clifton

Log Message

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.

Change Summary

差異

--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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+
111 2018-02-05 Maciej W. Rozycki <macro@mips.com>
212
313 * testsuite/binutils-all/mips/mips-reginfo.d: New test.
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -655,7 +655,8 @@ find_section (Filedata * filedata, const char * name)
655655 {
656656 unsigned int i;
657657
658- assert (filedata->section_headers != NULL);
658+ if (filedata->section_headers == NULL)
659+ return NULL;
659660
660661 for (i = 0; i < filedata->file_header.e_shnum; i++)
661662 if (streq (SECTION_NAME (filedata->section_headers + i), name))
@@ -672,6 +673,9 @@ find_section_by_address (Filedata * filedata, bfd_vma addr)
672673 {
673674 unsigned int i;
674675
676+ if (filedata->section_headers == NULL)
677+ return NULL;
678+
675679 for (i = 0; i < filedata->file_header.e_shnum; i++)
676680 {
677681 Elf_Internal_Shdr *sec = filedata->section_headers + i;
@@ -688,6 +692,9 @@ find_section_by_type (Filedata * filedata, unsigned int type)
688692 {
689693 unsigned int i;
690694
695+ if (filedata->section_headers == NULL)
696+ return NULL;
697+
691698 for (i = 0; i < filedata->file_header.e_shnum; i++)
692699 {
693700 Elf_Internal_Shdr *sec = filedata->section_headers + i;
@@ -707,6 +714,9 @@ find_section_in_set (Filedata * filedata, const char * name, unsigned int * set)
707714 {
708715 unsigned int i;
709716
717+ if (filedata->section_headers == NULL)
718+ return NULL;
719+
710720 if (set != NULL)
711721 {
712722 while ((i = *set++) > 0)