aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-19 23:33:37 +0000
committerIan Lance Taylor <iant@google.com>2007-10-19 23:33:37 +0000
commitfa1bd4fb25c5fb738010e77f1244161727b5f7bd (patch)
treee20158ba1244d67ae6ff705a32f1477de272870a /gold
parent6a718ea22c994d565c2c26daf11a760277ed6617 (diff)
downloadgdb-fa1bd4fb25c5fb738010e77f1244161727b5f7bd.zip
gdb-fa1bd4fb25c5fb738010e77f1244161727b5f7bd.tar.gz
gdb-fa1bd4fb25c5fb738010e77f1244161727b5f7bd.tar.bz2
Fix handling of wide string merge sections.
Diffstat (limited to 'gold')
-rw-r--r--gold/merge.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gold/merge.cc b/gold/merge.cc
index b5c836f..80d2d1a 100644
--- a/gold/merge.cc
+++ b/gold/merge.cc
@@ -259,16 +259,17 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
"character size"));
return false;
}
- len /= sizeof(Char_type);
+ // The index I is in bytes, not characters.
off_t i = 0;
while (i < len)
{
off_t plen = 0;
for (const Char_type* pl = p; *pl != 0; ++pl)
{
+ // The length PLEN is in characters, not bytes.
++plen;
- if (i + plen >= len)
+ if (i + plen * sizeof(Char_type) >= len)
{
object->error(_("entry in mergeable string section "
"not null terminated"));
@@ -281,7 +282,7 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
this->merged_strings_.push_back(Merged_string(object, shndx, i, str));
p += plen + 1;
- i += plen + 1;
+ i += (plen + 1) * sizeof(Char_type);
}
return true;