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
time-shift
Sébastien Villemot 2014-08-12 19:30:09 +02:00
parent 6d42861e19
commit 931ea41f18
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);
}