2024-02-05 17:21:00 +08:00
|
|
|
diff -rupN --no-dereference binutils-2.37/gold/fileread.cc binutils-2.37-new/gold/fileread.cc
|
|
|
|
|
--- binutils-2.37/gold/fileread.cc 2021-07-08 13:37:20.000000000 +0200
|
|
|
|
|
+++ binutils-2.37-new/gold/fileread.cc 2021-07-24 21:59:22.937765719 +0200
|
|
|
|
|
@@ -385,6 +385,12 @@ File_read::do_read(off_t start, section_
|
2020-10-08 17:29:50 +08:00
|
|
|
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)
|
|
|
|
|
{
|