// attributes.cc -- object attributes for gold
-// Copyright 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009-2014 Free Software Foundation, Inc.
// Written by Doug Kwan <dougkwan@google.com>.
// This file contains code adapted from BFD.
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)
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)
std::vector<unsigned char> 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);
}