aboutsummaryrefslogtreecommitdiff
path: root/gold/fileread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/fileread.cc')
-rw-r--r--gold/fileread.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gold/fileread.cc b/gold/fileread.cc
index 2b653f7..af2df21 100644
--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -385,6 +385,12 @@ File_read::do_read(off_t start, section_size_type size, void* p)
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)
{