aboutsummaryrefslogtreecommitdiff
path: root/gold/stringpool.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-07-24 07:23:20 +0000
committerIan Lance Taylor <ian@airs.com>2008-07-24 07:23:20 +0000
commit5778530ea76fb119f3a77b0c699aa938369bc063 (patch)
tree30507cbded91cda28da55ea2586bc28dc874676c /gold/stringpool.h
parent7f649c59d1863d01c97a920232f86fdacaac2199 (diff)
downloadfsf-binutils-gdb-5778530ea76fb119f3a77b0c699aa938369bc063.zip
fsf-binutils-gdb-5778530ea76fb119f3a77b0c699aa938369bc063.tar.gz
fsf-binutils-gdb-5778530ea76fb119f3a77b0c699aa938369bc063.tar.bz2
* stringpool.cc (Stringpool_template::add_with_length): Set key to
array size plus one. (Stringpool_template::set_string_offsets): Subtract one from key before using it as an array index. (Stringpool_template::get_offset_with_length): Likewise. (Stringpool_template::write_to_buffer): Likewise. * stringpool.h (Stringpool_template::get_offset_from_key): Likewise.
Diffstat (limited to 'gold/stringpool.h')
-rw-r--r--gold/stringpool.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gold/stringpool.h b/gold/stringpool.h
index 1b80842..6fe2066 100644
--- a/gold/stringpool.h
+++ b/gold/stringpool.h
@@ -220,8 +220,8 @@ class Stringpool_template
section_offset_type
get_offset_from_key(Key k) const
{
- gold_assert(k < this->key_to_offset_.size());
- return this->key_to_offset_[k];
+ gold_assert(k <= this->key_to_offset_.size());
+ return this->key_to_offset_[k - 1];
}
// Get the size of the string table. This returns the number of