Subject: 29.0.50; [PATCH] Raise an error if creating an unknown xwidget type

From: Po Lu <[email-masked]>
Date: Mon, 08 Nov 2021 15:07:45 +0800

Otherwise code can create bogus xwidgets for whom widget_osr and
widgetwindow_osr are NULL, which can cause crashes.

>From c9155cfe0f1c8c0d51c81db01a0e942f6bed4345 Mon Sep 17 00:00:00 2001
From: Po Lu <[email-masked]>
Date: Mon, 8 Nov 2021 15:06:10 +0800
Subject: [PATCH] Raise an error if creating an unknown xwidget type

* src/xwidget.c (Fmake_xwidget): Error if TYPE is invalid.
---
 src/xwidget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xwidget.c b/src/xwidget.c
index 2d9351308e..ec0c283c80 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -128,6 +128,9 @@ DEFUN ("make-xwidget",
   CHECK_FIXNAT (width);
   CHECK_FIXNAT (height);
 
+  if (!EQ (type, Qwebkit))
+    error ("Bad xwidget type");
+
   struct xwidget *xw = allocate_xwidget ();
   Lisp_Object val;
   xw->type = type;
-- 
2.31.1