diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-07-24 07:23:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-07-24 07:23:20 +0000 |
commit | 5778530ea76fb119f3a77b0c699aa938369bc063 (patch) | |
tree | 30507cbded91cda28da55ea2586bc28dc874676c /gold/stringpool.h | |
parent | 7f649c59d1863d01c97a920232f86fdacaac2199 (diff) | |
download | gdb-5778530ea76fb119f3a77b0c699aa938369bc063.zip gdb-5778530ea76fb119f3a77b0c699aa938369bc063.tar.gz 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.h | 4 |
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 |