Blame SOURCES/binutils-CVE-2019-1010204.patch

e89428
diff -rupN --no-dereference binutils-2.37/gold/fileread.cc binutils-2.37-new/gold/fileread.cc
e89428
--- binutils-2.37/gold/fileread.cc	2021-07-08 13:37:20.000000000 +0200
e89428
+++ binutils-2.37-new/gold/fileread.cc	2021-07-24 21:59:22.937765719 +0200
e89428
@@ -385,6 +385,12 @@ File_read::do_read(off_t start, section_
e89428
   ssize_t bytes;
e89428
   if (this->whole_file_view_ != NULL)
e89428
     {
e89428
+      // See PR 23765 for an example of a testcase that triggers this error.
e89428
+      if (((ssize_t) start) < 0)
e89428
+	gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
e89428
+		   this->filename().c_str(),
e89428
+		   static_cast<long long>(start));
e89428
+	
e89428
       bytes = this->size_ - start;
e89428
       if (static_cast<section_size_type>(bytes) >= size)
e89428
 	{