On 11/24/20 4:59 PM, Richard Kimberly Heck wrote:
On 11/24/20 4:29 PM, Yuriy Skalko wrote:
As for the patch 5, these null pointer dereferences happen even on opening LyX manuals. It is undefined behavior even if it doesn't crash LyX. Most likely should be fixed somewhere instead of just checking.
From 234bfe70c1e2766d856257aebe7eaad8836f5976 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Tue, 24 Nov 2020 22:59:24 +0200
Subject: [PATCH 5/5] Add nullptr checks

---
 src/mathed/InsetMathMacro.cpp | 2 ++
 src/mathed/InsetMathNest.cpp  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index c085439017..2c5f6b35a0 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -85,6 +85,8 @@ using cap::selClearOrDel;
 InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
     : InsetMath(buf), cells_(nargs), lock_(false)
 {
+    if (!buf)
+        LYXERR0("Passing nullptr as reference");
     setBuffer(*buf);
 }

This one comes from the same place. I'll adopt the same solution there.

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to