[LyX/2.3.x] Fix a crash with uninitialized buffer member of MathData

Stephan Witt switt at lyx.org
Sat Feb 8 15:15:55 UTC 2020


commit 058283515a5601e99494c0496f45b616b0fff436
Author: Stephan Witt <switt at lyx.org>
Date:   Sat Feb 8 16:33:51 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
---
 src/mathed/InsetMathNest.cpp |    6 ++++--
 status.23x                   |    4 +++-
 2 files changed, 7 insertions(+), 3 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]);
diff --git a/status.23x b/status.23x
index f93844e..147b17b 100644
--- a/status.23x
+++ b/status.23x
@@ -53,7 +53,6 @@ What's new
 
 - Correctly strike out deleted text after deleted display math (bug 11716).
 
-
 * USER INTERFACE
 
 - Fix backspace deletion of selected items with change tracking (bug 11630).
@@ -65,6 +64,9 @@ What's new
 
 - Properly resize columns of child document table widget.
 
+- Fix a crash reported on lyx users.
+  There was an uninitialized buffer member of MathData in LFUN dispatch.
+
 
 * INTERNALS
 


More information about the lyx-cvs mailing list