emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 71ca4f6: Avoid relocating buffers while libxml2 r


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 71ca4f6: Avoid relocating buffers while libxml2 reads its text
Date: Sun, 23 Oct 2016 16:54:01 +0000 (UTC)

branch: emacs-25
commit 71ca4f6a43bad06192cbc4bb8c7a2d69c179b7b0
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid relocating buffers while libxml2 reads its text
    
    * src/xml.c (parse_region) [REL_ALLOC]: Freeze the ralloc arena
    while libxml2 reads the current buffer's text.  (Bug#24764)
---
 src/xml.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xml.c b/src/xml.c
index 1ef84bd..612b16c 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -202,6 +202,11 @@ parse_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object base_url,
     }
 
   buftext = BYTE_POS_ADDR (istart_byte);
+#ifdef REL_ALLOC
+  /* Prevent ralloc.c from relocating the current buffer while libxml2
+     functions below read its text.  */
+  r_alloc_inhibit_buffer_relocation (1);
+#endif
   if (htmlp)
     doc = htmlReadMemory ((char *)buftext,
                          iend_byte - istart_byte, burl, "utf-8",
@@ -214,6 +219,9 @@ parse_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object base_url,
                         XML_PARSE_NONET|XML_PARSE_NOWARNING|
                         XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
 
+#ifdef REL_ALLOC
+  r_alloc_inhibit_buffer_relocation (0);
+#endif
   /* If the assertion below fails, malloc was called inside the above
      libxml2 functions, and ralloc.c caused relocation of buffer text,
      so we could have read from unrelated memory.  */



reply via email to

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