diff options
author | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2013-08-11 22:51:47 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2013-08-11 22:51:47 +0200 |
commit | 99a32242b364793076b4b03310c435d4828ef6e4 (patch) | |
tree | c314d25d6a80d4d548003e6f5e3079a3c6d3e956 /src/decompress.c | |
parent | 313546eb796f4588c1c9af60f08f2bd122ef0bdb (diff) | |
download | emacs-99a32242b364793076b4b03310c435d4828ef6e4.tar.gz |
Fix decompress gap handling bug
* decompress.c (Fdecompress_gzipped_region): Respect all zlib
errors, and really move the gap to where we want it.
Diffstat (limited to 'src/decompress.c')
-rw-r--r-- | src/decompress.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/decompress.c b/src/decompress.c index 18f7884a4c2..a6323a843e9 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -63,7 +63,6 @@ This function can only be called in unibyte buffers.*/) ptrdiff_t count = SPECPDL_INDEX (); validate_region (&start, &end); - move_gap_both (iend, iend); if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) error ("This function can only be called in unibyte buffers"); @@ -72,6 +71,7 @@ This function can only be called in unibyte buffers.*/) the same. */ istart = XINT (start); iend = XINT (end); + move_gap_both (iend, iend); stream.zalloc = Z_NULL; stream.zfree = Z_NULL; @@ -99,13 +99,11 @@ This function can only be called in unibyte buffers.*/) /* Run inflate() on input until the output buffer isn't full. */ do { + int result; stream.avail_out = BUFFER_SIZE; stream.next_out = out; - switch (inflate (&stream, Z_NO_FLUSH)) { - case Z_STREAM_ERROR: - case Z_NEED_DICT: - case Z_DATA_ERROR: - case Z_MEM_ERROR: + result = inflate (&stream, Z_NO_FLUSH); + if (result < 0) { unbind_to (count, Qnil); return Qnil; } |