summaryrefslogtreecommitdiff
path: root/src/charset.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-05-28 19:50:10 +0300
committerEli Zaretskii <eliz@gnu.org>2012-05-28 19:50:10 +0300
commit291d430f5f184c8a9438eace09b141131de343e8 (patch)
tree6310a9eb6bbf4643505fa67d0b012dad81624aa0 /src/charset.c
parente383e32d7a00bf286db1dc6b05b6219f0eaab8dc (diff)
downloademacs-291d430f5f184c8a9438eace09b141131de343e8.tar.gz
Avoid buffer text relocations in calls to STRING_CHAR_* macros.
src/charset.c (maybe_unify_char): Inhibit relocation of buffer text for the duration of call to load_charset, to avoid problems with callers of maybe_unify_char that access buffer text through C pointers. src/ralloc.c (r_alloc_inhibit_buffer_relocation): Increment and decrement the inhibition flag, instead of just setting or resetting it. Fixes: debbugs:11519
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/charset.c b/src/charset.c
index 57e1603fc19..d287fc0bece 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1641,6 +1641,12 @@ maybe_unify_char (int c, Lisp_Object val)
return c;
CHECK_CHARSET_GET_CHARSET (val, charset);
+#ifdef REL_ALLOC
+ /* The call to load_charset below can allocate memory, whcih screws
+ callers of this function through STRING_CHAR_* macros that hold C
+ pointers to buffer text, if REL_ALLOC is used. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
load_charset (charset, 1);
if (! inhibit_load_charset_map)
{
@@ -1656,6 +1662,9 @@ maybe_unify_char (int c, Lisp_Object val)
if (unified > 0)
c = unified;
}
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return c;
}