PR 23765
* fileread.cc (File_read::do_read): Check start parameter before
computing number of bytes to read.
+2022-06-27 Nick Clifton <nickc@redhat.com>
+
+ PR 23765
+ * fileread.cc (File_read::do_read): Check start parameter before
+ computing number of bytes to read.
+
2022-05-18 Nick Clifton <nickc@redhat.com>
* int_encoding.cc (get_length_as_unsigned_LEB_128): Remove
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)
{