+2019-09-20 Alan Modra <amodra@gmail.com>
+
+ PR 24768
+ * layout.cc (Layout::Layout): Init lto_slim_object_.
+ * object.cc (Sized_relobj_file::do_layout): Wrap overlong line.
+ Don't use C cast. Validate section size. Don't copy contents.
+
2019-09-20 Alan Modra <amodra@gmail.com>
* powerpc.cc (Target_powerpc::Scan::check_non_pic): Move REL24
unique_segment_for_sections_specified_(false),
incremental_inputs_(NULL),
record_output_section_data_from_script_(false),
+ lto_slim_object_(false),
script_output_section_data_list_(),
segment_states_(NULL),
relaxation_debug_check_(NULL),
if (strncmp (name, lto_section_name, strlen (lto_section_name)) == 0)
{
section_size_type contents_len;
- const unsigned char* pcontents = this->section_contents(i, &contents_len, false);
- struct lto_section lsection = *(const lto_section*)pcontents;
- if (lsection.slim_object)
- layout->set_lto_slim_object ();
+ const unsigned char* pcontents
+ = this->section_contents(i, &contents_len, false);
+ if (contents_len >= sizeof(lto_section))
+ {
+ const lto_section* lsection
+ = reinterpret_cast<const lto_section*>(pcontents);
+ if (lsection->slim_object)
+ layout->set_lto_slim_object();
+ }
}
}