diff options
| author | Richard M. Stallman | 2002-08-17 04:55:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-08-17 04:55:17 +0000 |
| commit | 6388456397cf16a5410928d2b94a60cd6f92aed7 (patch) | |
| tree | d0aeab626c240b49e42f3f2170109d26dd65af82 /src | |
| parent | 4b0e44fc728df2f5d40b7e15a5b490b001503bbb (diff) | |
| download | emacs-6388456397cf16a5410928d2b94a60cd6f92aed7.tar.gz emacs-6388456397cf16a5410928d2b94a60cd6f92aed7.zip | |
(save_restriction_restore): Defend from unchained marker.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/editfns.c b/src/editfns.c index e8b12d76a3c..8640111c167 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2834,7 +2834,8 @@ save_restriction_restore (data) | |||
| 2834 | struct Lisp_Marker *end = XMARKER (XCDR (data)); | 2834 | struct Lisp_Marker *end = XMARKER (XCDR (data)); |
| 2835 | struct buffer *buf = beg->buffer; /* END should have the same buffer. */ | 2835 | struct buffer *buf = beg->buffer; /* END should have the same buffer. */ |
| 2836 | 2836 | ||
| 2837 | if (beg->charpos != BUF_BEGV(buf) || end->charpos != BUF_ZV(buf)) | 2837 | if (buf /* Verify marker still points to a buffer. */ |
| 2838 | && (beg->charpos != BUF_BEGV (buf) || end->charpos != BUF_ZV (buf))) | ||
| 2838 | /* The restriction has changed from the saved one, so restore | 2839 | /* The restriction has changed from the saved one, so restore |
| 2839 | the saved restriction. */ | 2840 | the saved restriction. */ |
| 2840 | { | 2841 | { |
| @@ -2847,7 +2848,7 @@ save_restriction_restore (data) | |||
| 2847 | /* The point is outside the new visible range, move it inside. */ | 2848 | /* The point is outside the new visible range, move it inside. */ |
| 2848 | SET_BUF_PT_BOTH (buf, | 2849 | SET_BUF_PT_BOTH (buf, |
| 2849 | clip_to_bounds (beg->charpos, pt, end->charpos), | 2850 | clip_to_bounds (beg->charpos, pt, end->charpos), |
| 2850 | clip_to_bounds (beg->bytepos, BUF_PT_BYTE(buf), | 2851 | clip_to_bounds (beg->bytepos, BUF_PT_BYTE (buf), |
| 2851 | end->bytepos)); | 2852 | end->bytepos)); |
| 2852 | 2853 | ||
| 2853 | buf->clip_changed = 1; /* Remember that the narrowing changed. */ | 2854 | buf->clip_changed = 1; /* Remember that the narrowing changed. */ |
| @@ -2858,11 +2859,12 @@ save_restriction_restore (data) | |||
| 2858 | { | 2859 | { |
| 2859 | struct buffer *buf = XBUFFER (data); | 2860 | struct buffer *buf = XBUFFER (data); |
| 2860 | 2861 | ||
| 2861 | if (BUF_BEGV(buf) != BUF_BEG(buf) || BUF_ZV(buf) != BUF_Z(buf)) | 2862 | if (buf /* Verify marker still points to a buffer. */ |
| 2863 | && (BUF_BEGV (buf) != BUF_BEG (buf) || BUF_ZV (buf) != BUF_Z (buf))) | ||
| 2862 | /* The buffer has been narrowed, get rid of the narrowing. */ | 2864 | /* The buffer has been narrowed, get rid of the narrowing. */ |
| 2863 | { | 2865 | { |
| 2864 | SET_BUF_BEGV_BOTH (buf, BUF_BEG(buf), BUF_BEG_BYTE(buf)); | 2866 | SET_BUF_BEGV_BOTH (buf, BUF_BEG (buf), BUF_BEG_BYTE (buf)); |
| 2865 | SET_BUF_ZV_BOTH (buf, BUF_Z(buf), BUF_Z_BYTE(buf)); | 2867 | SET_BUF_ZV_BOTH (buf, BUF_Z (buf), BUF_Z_BYTE (buf)); |
| 2866 | 2868 | ||
| 2867 | buf->clip_changed = 1; /* Remember that the narrowing changed. */ | 2869 | buf->clip_changed = 1; /* Remember that the narrowing changed. */ |
| 2868 | } | 2870 | } |