[LyX/2.3.4-2] Fix a crash with uninitialized buffer member of MathData

Richard Kimberly Heck rikiheck at lyx.org
Sat Feb 8 18:51:59 UTC 2020


commit 2bf2294697212cceed9873165b584f896e310993
Author: Stephan Witt <switt at lyx.org>
Date:   Fri Feb 7 10:17:33 2020 +0100

    Fix a crash with uninitialized buffer member of MathData
    
    See the details here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210294.html
    
    (cherry picked from commit 59fa0b25928b43c8d32d19a6193dc3bd07716947)
---
 src/mathed/InsetMathNest.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index bc3c2ad..db03dab 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1232,10 +1232,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 		cur.recordUndoSelection();
 		if (cmd.argument() == "^" || cmd.argument() == "_")
 			interpretChar(cur, cmd.argument()[0]);
+		else if (!cur.selection())
+			cur.niceInsert(cmd.argument());
 		else {
-			MathData ar;
+			MathData ar(cur.buffer());
 			asArray(cmd.argument(), ar);
-			if (cur.selection() && ar.size() == 1
+			if (ar.size() == 1
 			    && ar[0]->asNestInset()
 			    && ar[0]->asNestInset()->nargs() > 1)
 				handleNest(cur, ar[0]);


More information about the lyx-cvs mailing list