2008-06-25 Cary Coutant <ccoutant@google.com>
authorCary Coutant <ccoutant@google.com>
Wed, 25 Jun 2008 17:10:08 +0000 (17:10 +0000)
committerCary Coutant <ccoutant@google.com>
Wed, 25 Jun 2008 17:10:08 +0000 (17:10 +0000)
* fileread.cc (File_read::make_view): Assert on zero-length view.
* object.cc (Sized_relobj::do_read_symbols): Don't try to read
symbol table when there are no symbols to read.

gold/ChangeLog
gold/fileread.cc
gold/object.cc

index 22f549b36d4f4c1385680e84ac0bcd5798c9c33c..b8d811866ff981e7dbe2767da913a4f19120fa2e 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-25  Cary Coutant  <ccoutant@google.com>
+
+       * fileread.cc (File_read::make_view): Assert on zero-length view.
+       * object.cc (Sized_relobj::do_read_symbols): Don't try to read
+       symbol table when there are no symbols to read.
+
 2008-06-23  Craig Silverstein  <csilvers@google.com>
 
        * version.cc (version_string): Bump to 1.7
index 6cb056fd1d27b9ab18d44a30d7b663c01e4f60d3..cfe0ee6debbeb72293afe9a576e69087868ff502 100644 (file)
@@ -327,6 +327,8 @@ File_read::View*
 File_read::make_view(off_t start, section_size_type size,
                     unsigned int byteshift, bool cache)
 {
+  gold_assert(size > 0);
+
   off_t poff = File_read::page_offset(start);
 
   section_size_type psize = File_read::pages(size + (start - poff));
index b49bee17502b0387aadddd8fe56abe8b99897984..8659cb24ba54e3e5cb07d2cb861f7460fc7983c0 100644 (file)
@@ -452,6 +452,12 @@ Sized_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
   off_t readoff = this->has_eh_frame_ ? dataoff : extoff;
   section_size_type readsize = this->has_eh_frame_ ? datasize : extsize;
 
+  if (readsize == 0)
+    {
+      // No external symbols.  Also weird but also legal.
+      return;
+    }
+
   File_view* fvsymtab = this->get_lasting_view(readoff, readsize, true, false);
 
   // Read the section header for the symbol names.
This page took 0.032 seconds and 4 git commands to generate.