mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +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
fef787a80a
commit
8bc83f123a
@ -917,8 +917,17 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const
|
||||
MathData ar(const_cast<Buffer *>(&buffer()));
|
||||
MacroData const * data = buffer().getMacro(name());
|
||||
if (data) {
|
||||
asArray(data->definition(), ar);
|
||||
ar.validate(features);
|
||||
// Avoid recursion on a recursive macro definition
|
||||
docstring const & def = data->definition();
|
||||
int pos = tokenPos(def, '\\', name());
|
||||
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')))) {
|
||||
asArray(def, ar);
|
||||
ar.validate(features);
|
||||
}
|
||||
}
|
||||
}
|
||||
InsetMathNest::validate(features);
|
||||
|
@ -42,6 +42,7 @@ What's new
|
||||
|
||||
* USER INTERFACE
|
||||
|
||||
- Avoid crashing on a recursive macro definition (bug 12633).
|
||||
|
||||
|
||||
* INTERNALS
|
||||
|
Loading…
Reference in New Issue
Block a user