GNU bug report logs - #13743
24.2.93; Segmentation fault when trying to [s]teal a file opened elsewhere

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Mon, 18 Feb 2013 07:14:01 UTC

Severity: important

Found in version 24.2.93

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13743 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: bug#13743: 24.2.93; Segmentation fault when trying to [s]teal a file opened elsewhere
Date: Sat, 23 Feb 2013 11:59:18 -0500
> I can fix this particular problem with this simple patch:
[...]
> However, I'm not sure this is the right or the best way.  If it is, it
> will probably be prudent to add some protection against infinite
> recursion here.

How 'bout moving the

   if (BUFFERP (object))
     modify_region (object, start, end);

earlier in the function.  Something like the patch below.


        Stefan


=== modified file 'src/textprop.c'
--- src/textprop.c	2013-01-02 16:13:04 +0000
+++ src/textprop.c	2013-02-23 16:58:50 +0000
@@ -60,7 +60,7 @@
 static Lisp_Object Qread_only;
 Lisp_Object Qminibuffer_prompt;
 
-/* Sticky properties */
+/* Sticky properties.  */
 Lisp_Object Qfront_sticky, Qrear_nonsticky;
 
 /* If o1 is a cons whose cdr is a cons, return non-zero and set o2 to
@@ -1145,9 +1145,16 @@
   if (!i)
     return Qnil;
 
+  if (BUFFERP (object))
+    modify_region (object, start, end);
+
   s = XINT (start);
   len = XINT (end) - s;
 
+  /* Recompute `i' since modify_region may have performed indirectly
+     arbitrary modifications to the interval tree.  */
+  i = interval_of (s, object);
+
   /* No need to protect OBJECT, because we GC only if it's a buffer,
      and live buffers are always protected.  */
   GCPRO1 (properties);
@@ -1174,9 +1181,6 @@
 	}
     }
 
-  if (BUFFERP (object))
-    modify_region (object, start, end);
-
   /* We are at the beginning of interval I, with LEN chars to scan.  */
   for (;;)
     {





This bug report was last modified 12 years and 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.