summaryrefslogtreecommitdiff
path: root/src/decompress.c
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2013-08-14 14:47:05 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2013-08-14 14:47:05 +0200
commit71530c97bfa0a2527f6b99ab2bc00865bc8699f2 (patch)
tree8d530432ad24ffacbe29a0e1853e2592af2e7ed5 /src/decompress.c
parent5faf4899f09ea5a34b5a46cce132047a06de97d4 (diff)
downloademacs-71530c97bfa0a2527f6b99ab2bc00865bc8699f2.tar.gz
emacs-71530c97bfa0a2527f6b99ab2bc00865bc8699f2.tar.bz2
emacs-71530c97bfa0a2527f6b99ab2bc00865bc8699f2.zip
* decompress.c (unwind_decompress): Always restore point.
Diffstat (limited to 'src/decompress.c')
-rw-r--r--src/decompress.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/decompress.c b/src/decompress.c
index c54a34e050e..b4e122c3ba8 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -95,12 +95,14 @@ unwind_decompress (void *ddata)
struct decompress_unwind_data *data = ddata;
fn_inflateEnd (data->stream);
- /* Delete any uncompressed data already inserted and restore point. */
+ /* Delete any uncompressed data already inserted on error. */
if (data->start)
- {
- del_range (data->start, PT);
- SET_PT (data->old_point);
- }
+ del_range (data->start, PT);
+
+ /* Put point where it was, or if the buffer has shrunk because the
+ compressed data is bigger than the uncompressed, at
+ point-max. */
+ SET_PT (min (data->old_point, ZV));
}
DEFUN ("zlib-available-p", Fzlib_available_p, Szlib_available_p, 0, 0, 0,