aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2012-08-28 09:01:59 -0700
committerGlenn Morris2012-08-28 09:01:59 -0700
commiteada086196ccb005ded188ac2e58d41f3682a125 (patch)
treef195bbf91841ea4e85d465307d62c709924892c2 /src
parent37b9743e79bac608a45fade0744248446aaa0a33 (diff)
parent806f0cc7302bd1dacfad8366f67a97e9bfbc8fc9 (diff)
downloademacs-eada086196ccb005ded188ac2e58d41f3682a125.tar.gz
emacs-eada086196ccb005ded188ac2e58d41f3682a125.zip
Merge from emacs-24; up to 2012-05-04T19:17:01Z!monnier@iro.umontreal.ca
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/eval.c9
-rw-r--r--src/ralloc.c45
3 files changed, 45 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2521ddc4144..5bafa1a04f8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12012-08-28 Eli Zaretskii <eliz@gnu.org>
2
3 * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it
4 is not one of the heaps we manage. (Bug#12242)
5
62012-08-28 Glenn Morris <rgm@gnu.org>
7
8 * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747)
9
12012-08-28 Martin Rudalics <rudalics@gmx.at> 102012-08-28 Martin Rudalics <rudalics@gmx.at>
2 11
3 * window.c (Fset_window_configuration): Remove handling of 12 * window.c (Fset_window_configuration): Remove handling of
diff --git a/src/eval.c b/src/eval.c
index df44c87dc25..c56be10c5a0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -544,11 +544,10 @@ thinking of using it for any other purpose, it is quite likely that
544you're making a mistake. Think: what do you want to do when the 544you're making a mistake. Think: what do you want to do when the
545command is called from a keyboard macro? 545command is called from a keyboard macro?
546 546
547This function is meant for implementing advice and other 547Instead of using this function, it is sometimes cleaner to give your
548function-modifying features. Instead of using this, it is sometimes 548function an extra optional argument whose `interactive' spec specifies
549cleaner to give your function an extra optional argument whose 549non-nil unconditionally (\"p\" is a good way to do this), or via
550`interactive' spec specifies non-nil unconditionally (\"p\" is a good 550\(not (or executing-kbd-macro noninteractive)). */)
551way to do this), or via (not (or executing-kbd-macro noninteractive)). */)
552 (Lisp_Object kind) 551 (Lisp_Object kind)
553{ 552{
554 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) 553 return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
diff --git a/src/ralloc.c b/src/ralloc.c
index c40258693f5..3877e21d4f6 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -670,6 +670,7 @@ static void
670free_bloc (bloc_ptr bloc) 670free_bloc (bloc_ptr bloc)
671{ 671{
672 heap_ptr heap = bloc->heap; 672 heap_ptr heap = bloc->heap;
673 heap_ptr h;
673 674
674 if (r_alloc_freeze_level) 675 if (r_alloc_freeze_level)
675 { 676 {
@@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc)
699 bloc->prev->next = bloc->next; 700 bloc->prev->next = bloc->next;
700 } 701 }
701 702
702 /* Update the records of which blocs are in HEAP. */ 703 /* Sometimes, 'heap' obtained from bloc->heap above is not really a
703 if (heap->first_bloc == bloc) 704 'heap' structure. It can even be beyond the current break point,
705 which will cause crashes when we dereference it below (see
706 bug#12242). Evidently, the reason is bloc allocations done while
707 use_relocatable_buffers was non-positive, because additional
708 memory we get then is not recorded in the heaps we manage. If
709 bloc->heap records such a "heap", we cannot (and don't need to)
710 update its records. So we validate the 'heap' value by making
711 sure it is one of the heaps we manage via the heaps linked list,
712 and don't touch a 'heap' that isn't found there. This avoids
713 accessing memory we know nothing about. */
714 for (h = first_heap; h != NIL_HEAP; h = h->next)
715 if (heap == h)
716 break;
717
718 if (h)
704 { 719 {
705 if (bloc->next != 0 && bloc->next->heap == heap) 720 /* Update the records of which blocs are in HEAP. */
706 heap->first_bloc = bloc->next; 721 if (heap->first_bloc == bloc)
707 else 722 {
708 heap->first_bloc = heap->last_bloc = NIL_BLOC; 723 if (bloc->next != 0 && bloc->next->heap == heap)
709 } 724 heap->first_bloc = bloc->next;
710 if (heap->last_bloc == bloc) 725 else
711 { 726 heap->first_bloc = heap->last_bloc = NIL_BLOC;
712 if (bloc->prev != 0 && bloc->prev->heap == heap) 727 }
713 heap->last_bloc = bloc->prev; 728 if (heap->last_bloc == bloc)
714 else 729 {
715 heap->first_bloc = heap->last_bloc = NIL_BLOC; 730 if (bloc->prev != 0 && bloc->prev->heap == heap)
731 heap->last_bloc = bloc->prev;
732 else
733 heap->first_bloc = heap->last_bloc = NIL_BLOC;
734 }
716 } 735 }
717 736
718 relinquish (); 737 relinquish ();