From 71530c97bfa0a2527f6b99ab2bc00865bc8699f2 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Wed, 14 Aug 2013 14:47:05 +0200 Subject: [PATCH] * decompress.c (unwind_decompress): Always restore point. --- src/ChangeLog | 4 ++++ src/decompress.c | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c8a1de49d68..eeae85a888c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-08-14 Lars Magne Ingebrigtsen + + * decompress.c (unwind_decompress): Always restore point. + 2013-08-14 Paul Eggert * xdisp.c (cursor_type_changed): Now static. 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, -- 2.39.5