mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
2008-09-05 Cary Coutant <ccoutant@google.com>
* fileread.cc (File_read::make_view): Add check for attempt to map beyond end of file.
This commit is contained in:
parent
ebcf6f00fc
commit
a9caad024e
@ -1,3 +1,8 @@
|
||||
2008-09-05 Cary Coutant <ccoutant@google.com>
|
||||
|
||||
* fileread.cc (File_read::make_view): Add check for attempt to map
|
||||
beyond end of file.
|
||||
|
||||
2008-09-05 Cary Coutant <ccoutant@google.com>
|
||||
|
||||
* symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
|
||||
|
@ -355,6 +355,14 @@ File_read::make_view(off_t start, section_size_type size,
|
||||
{
|
||||
gold_assert(size > 0);
|
||||
|
||||
// Check that start and end of the view are within the file.
|
||||
if (start > this->size_ || size > this->size_ - start)
|
||||
gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds "
|
||||
"size of file; the file may be corrupt"),
|
||||
this->filename().c_str(),
|
||||
static_cast<long long>(size),
|
||||
static_cast<long long>(start));
|
||||
|
||||
off_t poff = File_read::page_offset(start);
|
||||
|
||||
section_size_type psize = File_read::pages(size + (start - poff));
|
||||
|
Loading…
Reference in New Issue
Block a user