From 931ea41f187a452f3ad6a2355e552b6710fbd41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 12 Aug 2014 19:30:09 +0200 Subject: [PATCH] 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 --- preprocessor/macro/MacroValue.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor/macro/MacroValue.cc b/preprocessor/macro/MacroValue.cc index 65b3fc39d..3dfab3233 100644 --- a/preprocessor/macro/MacroValue.cc +++ b/preprocessor/macro/MacroValue.cc @@ -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); }