APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1410010215 -3600
# Sat Sep 06 14:30:15 2014 +0100
# Node ID 2f22818d92d42460586af6894cdbc4166cba3e6b
# Parent 1b984807a2990fb31c0f6ae2b7c6bd833ed36394
#'x-store-cutbuffer-internal, correct order of type checks vs. member accesses
src/ChangeLog addition:
2014-09-06 Aidan Kehoe <kehoea(a)parhasard.net>
* select-x.c (Fx_store_cutbuffer_internal):
Correct the order of XSTRING_{DATA,LENGTH} vs. CHECK_STRING, make
sure the former is after the latter, avoiding crashes when passing
in arguments of the wrong type, or when ERROR_CHECK_STRUCTURES is
defined.
diff -r 1b984807a299 -r 2f22818d92d4 src/ChangeLog
--- a/src/ChangeLog Fri Aug 22 10:58:09 2014 +0100
+++ b/src/ChangeLog Sat Sep 06 14:30:15 2014 +0100
@@ -1,3 +1,11 @@
+2014-09-06 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * select-x.c (Fx_store_cutbuffer_internal):
+ Correct the order of XSTRING_{DATA,LENGTH} vs. CHECK_STRING, make
+ sure the former is after the latter, avoiding crashes when passing
+ in arguments of the wrong type, or when ERROR_CHECK_STRUCTURES is
+ defined.
+
2014-08-03 Aidan Kehoe <kehoea(a)parhasard.net>
* event-stream.c (allocate_command_builder):
diff -r 1b984807a299 -r 2f22818d92d4 src/select-x.c
--- a/src/select-x.c Fri Aug 22 10:58:09 2014 +0100
+++ b/src/select-x.c Sat Sep 06 14:30:15 2014 +0100
@@ -1379,9 +1379,8 @@
Display *display = DEVICE_X_DISPLAY (d);
Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
Atom cut_buffer_atom;
- const Ibyte *data = XSTRING_DATA (string);
- Bytecount bytes = XSTRING_LENGTH (string);
- Bytecount bytes_remaining;
+ const Ibyte *data;
+ Bytecount bytes, bytes_remaining;
Bytecount max_bytes = SELECTION_QUANTUM (display);
#ifdef MULE
const Ibyte *ptr, *end;
@@ -1393,7 +1392,10 @@
CHECK_CUTBUFFER (cutbuffer);
CHECK_STRING (string);
+
cut_buffer_atom = symbol_to_x_atom (d, cutbuffer, 0);
+ data = XSTRING_DATA (string);
+ bytes = XSTRING_LENGTH (string);
if (! cut_buffers_initialized)
initialize_cut_buffers (display, window);
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches