mingw-binutils/binutils-CVE-2019-1010204.patch
2021-02-15 16:28:48 +01:00

17 lines
732 B
Diff

diff -rupN --no-dereference binutils-2.36.1/gold/fileread.cc binutils-2.36.1-new/gold/fileread.cc
--- binutils-2.36.1/gold/fileread.cc 2021-01-09 11:47:34.000000000 +0100
+++ binutils-2.36.1-new/gold/fileread.cc 2021-02-13 18:13:17.754237190 +0100
@@ -385,6 +385,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)
{