mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Fix bug #12633
Avoid recursion when validating a macro that is defined recursively. This avoids a crash but the latex engine will choke on it, of course.
This commit is contained in:
parent
168af93020
commit
16e67d4ebb
@ -988,8 +988,16 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const
|
|||||||
MathData ar(const_cast<Buffer *>(&buffer()));
|
MathData ar(const_cast<Buffer *>(&buffer()));
|
||||||
MacroData const * data = buffer().getMacro(name());
|
MacroData const * data = buffer().getMacro(name());
|
||||||
if (data) {
|
if (data) {
|
||||||
asArray(data->definition(), ar);
|
// Avoid recursion on a recursive macro definition
|
||||||
ar.validate(features);
|
docstring const & def = data->definition();
|
||||||
|
int pos = tokenPos(def, '\\', name());
|
||||||
|
char_type c = def.at(pos + name().size());
|
||||||
|
if (pos < 0 || (name().size() > 1 &&
|
||||||
|
((c >= 'a' && c <= 'z') ||
|
||||||
|
(c >= 'A' && c <= 'Z')))) {
|
||||||
|
asArray(def, ar);
|
||||||
|
ar.validate(features);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user