X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fattributes.cc;h=78caea989770c655397b4aecea6c49f7de2465de;hb=1e5885b72e20ef874f526e77a4946b2655e6d3c3;hp=6b2260d7b94b164410cb034a2d19d875f78c893a;hpb=4f7872716e8b73149e9024e1b95db6c3cfa66bd1;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/attributes.cc b/gold/attributes.cc index 6b2260d7b9..78caea9897 100644 --- a/gold/attributes.cc +++ b/gold/attributes.cc @@ -1,6 +1,6 @@ // attributes.cc -- object attributes for gold -// Copyright 2009 Free Software Foundation, Inc. +// Copyright (C) 2009-2016 Free Software Foundation, Inc. // Written by Doug Kwan . // This file contains code adapted from BFD. @@ -276,9 +276,9 @@ Attributes_section_data::Attributes_section_data( this->vendor_object_attributes_[vendor] = new Vendor_object_attributes(vendor); - const unsigned char *p = view; + const unsigned char* p = view; p = view; - if (*(p++) == 'A') + if (size > 0 && p != NULL && *(p++) == 'A') { size--; while (size > 0) @@ -296,7 +296,7 @@ Attributes_section_data::Attributes_section_data( section_size -= section_name_size + 4; int vendor; - const char *std_section = parameters->target().attributes_vendor(); + const char* std_section = parameters->target().attributes_vendor(); if (std_section != NULL && strcmp(section_name, std_section) == 0) vendor = Object_attribute::OBJ_ATTR_PROC; else if (strcmp(section_name, "gnu") == 0) @@ -451,7 +451,7 @@ Output_attributes_section_data::do_write(Output_file* of) std::vector buffer; this->attributes_section_data_.write(&buffer); gold_assert(convert_to_section_size_type(buffer.size()) == oview_size); - memcpy(oview, buffer.data(), buffer.size()); + memcpy(oview, &buffer.front(), buffer.size()); of->write_output_view(this->offset(), oview_size, oview); }