[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117833: * keyboard.c (read_decoded_event_from_main_
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r117833: * keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca |
Date: |
Sun, 07 Sep 2014 13:27:43 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117833
revision-id: address@hidden
parent: address@hidden
author: Paul Eggert <address@hidden>
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-07 06:27:33 -0700
message:
* keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca
here for destination buffer, to work around what appears to be a
bug in decode_coding_c_string when the source and destination are
both C strings.
* keyboard.c (echo_add_key, menu_bar_items, tool_bar_items)
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/keyboard.c keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-09-07 07:04:01 +0000
+++ b/src/ChangeLog 2014-09-07 13:27:33 +0000
@@ -1,5 +1,10 @@
2014-09-07 Paul Eggert <address@hidden>
+ * keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca
+ here for destination buffer, to work around what appears to be a
+ bug in decode_coding_c_string when the source and destination are
+ both C strings.
+
Use SAFE_ALLOCA etc. to avoid unbounded stack allocation (Bug#18410).
This follows up on the recent thread in emacs-devel on alloca; see:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html
@@ -24,7 +29,8 @@
* ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf):
* ftxfont.c (ftxfont_draw):
* image.c (xbm_load, xpm_load, jpeg_load_body):
- * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items):
+ * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items)
+
* keymap.c (Fdescribe_buffer_bindings, describe_map):
* lread.c (openp):
* menu.c (digest_single_submenu, find_and_call_menu_selection)
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2014-09-07 07:04:01 +0000
+++ b/src/keyboard.c 2014-09-07 13:27:33 +0000
@@ -2362,7 +2362,14 @@
if (meta_key != 2)
for (i = 0; i < n; i++)
src[i] &= ~0x80;
- coding->destination = dest;
+
+ /* FIXME: For some reason decode_coding_c_string requires a
+ fresh output buffer each time, and reusing the old buffer can
+ make Emacs dump core. Avoid triggering the problem for now
+ by allocating a new buffer each time through the loop. */
+ bool please_fixme = true;
+ coding->destination = please_fixme ? alloca (n * 4) : dest;
+
coding->dst_bytes = n * 4;
decode_coding_c_string (coding, src, n, Qnil);
eassert (coding->produced_char <= n);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117833: * keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca,
Paul Eggert <=