|
@@ -105,7 +105,13 @@ stringToCharStringData(const MasterToken::StringRegion& str_region,
|
|
|
int c = (*s & 0xff);
|
|
|
if (escape && std::isdigit(c) != 0) {
|
|
|
c = decimalToNumber(s, s_end);
|
|
|
+ // decimalToNumber() already throws if (s_end - s) is less
|
|
|
+ // than 3, so the following assertion is unnecessary. But we
|
|
|
+ // assert it anyway. 'n' is an unsigned type (size_t) and
|
|
|
+ // can underflow.
|
|
|
assert(n >= 3);
|
|
|
+ // 'n' and 's' are also updated by 1 in the for statement's
|
|
|
+ // expression, so we update them by 2 instead of 3 here.
|
|
|
n -= 2;
|
|
|
s += 2;
|
|
|
} else if (!escape && c == '\\') {
|