emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e21c761d13: Prevent crashes with very large Motif targets tables


From: Po Lu
Subject: master e21c761d13: Prevent crashes with very large Motif targets tables
Date: Mon, 6 Jun 2022 21:46:00 -0400 (EDT)

branch: master
commit e21c761d13faa158fb8445a0df4a7af666ea2782
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Prevent crashes with very large Motif targets tables
    
    * src/xterm.c (xm_setup_dnd_targets): Catch errors around
    xm_write_targets_table lest we get a BadAlloc error.
---
 src/xterm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index ee396f38cc..a11a22ab10 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2029,9 +2029,16 @@ xm_setup_dnd_targets (struct x_display_info *dpyinfo,
         it back to 0.  There will probably be no more updates to the
         protocol either.  */
       header.protocol = XM_DRAG_PROTOCOL_VERSION;
+
+      x_catch_errors (dpyinfo->display);
       xm_write_targets_table (dpyinfo->display, drag_window,
                              dpyinfo->Xatom_MOTIF_DRAG_TARGETS,
                              &header, recs);
+      /* Presumably we got a BadAlloc upon writing the targets
+        table.  */
+      if (x_had_errors_p (dpyinfo->display))
+       idx = -1;
+      x_uncatch_errors_after_check ();
     }
 
   XUngrabServer (dpyinfo->display);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]