]> git.lyx.org Git - features.git/commitdiff
Amend 16e67d4e
authorEnrico Forestieri <forenr@lyx.org>
Fri, 27 Jan 2023 20:10:02 +0000 (21:10 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 27 Jan 2023 20:10:02 +0000 (21:10 +0100)
A docstring is not 0-terminated...

src/mathed/InsetMathMacro.cpp

index aba4ab79a0d215b6c1bb23d2fb2e9681f123d002..a90bf87f5e2d6bf1f5b4a7601695e286a5073214 100644 (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')))) {