A docstring is not 0-terminated...
This commit is contained in:
Enrico Forestieri 2023-01-27 21:10:02 +01:00
parent 16e67d4ebb
commit 07150cd928

View File

@ -991,7 +991,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const
// Avoid recursion on a recursive macro definition
docstring const & def = data->definition();
int pos = tokenPos(def, '\\', name());
char_type c = def.at(pos + name().size());
char_type c = pos + name().size() < def.size()
? def.at(pos + name().size()) : 0;
if (pos < 0 || (name().size() > 1 &&
((c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z')))) {