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 #708time-shift
parent
6d42861e19
commit
931ea41f18
|
@ -387,7 +387,7 @@ StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsEr
|
||||||
if (*it < 1 || *it > (int) value.length())
|
if (*it < 1 || *it > (int) value.length())
|
||||||
throw OutOfBoundsError();
|
throw OutOfBoundsError();
|
||||||
char c = value.at(*it - 1);
|
char c = value.at(*it - 1);
|
||||||
result.append(&c);
|
result.append(1, c);
|
||||||
}
|
}
|
||||||
return new StringMV(driver, result);
|
return new StringMV(driver, result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue