Fix substring operator in macro-processor.

The characters of the substring could be mixed with random characters from the
memory space. Thanks to Tom Holden for reporting the bug.

Closes #708
issue#70
Sébastien Villemot 2014-08-12 19:30:09 +02:00
parent 56e1ed2f12
commit 6d22ae06cb
1 changed files with 1 additions and 1 deletions

View File

@ -387,7 +387,7 @@ StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsEr
if (*it < 1 || *it > (int) value.length())
throw OutOfBoundsError();
char c = value.at(*it - 1);
result.append(&c);
result.append(1, c);
}
return new StringMV(driver, result);
}