Blob Blame History Raw
--- binutils.orig/gold/fileread.cc	2019-11-08 10:33:58.911577903 +0000
+++ binutils-2.30/gold/fileread.cc	2019-11-08 10:34:13.001470092 +0000
@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_
   ssize_t bytes;
   if (this->whole_file_view_ != NULL)
     {
+      // See PR 23765 for an example of a testcase that triggers this error.
+      if (((ssize_t) start) < 0)
+	gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
+		   this->filename().c_str(),
+		   static_cast<long long>(start));
+	
       bytes = this->size_ - start;
       if (static_cast<section_size_type>(bytes) >= size)
 	{