aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2013-08-11 22:51:47 +0200
committerLars Magne Ingebrigtsen2013-08-11 22:51:47 +0200
commit99a32242b364793076b4b03310c435d4828ef6e4 (patch)
treec314d25d6a80d4d548003e6f5e3079a3c6d3e956 /src
parent313546eb796f4588c1c9af60f08f2bd122ef0bdb (diff)
downloademacs-99a32242b364793076b4b03310c435d4828ef6e4.tar.gz
emacs-99a32242b364793076b4b03310c435d4828ef6e4.zip
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')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/decompress.c10
2 files changed, 7 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 340e8407b33..1780bf4e797 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12013-08-11 Lars Magne Ingebrigtsen <larsi@gnus.org> 12013-08-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * decompress.c (Fdecompress_gzipped_region): Respect all zlib
4 errors, and really move the gap to where we want it.
5
3 * lisp.h: Include decompress.c support. 6 * lisp.h: Include decompress.c support.
4 7
5 * emacs.c (main): Include decompress.c support. 8 * emacs.c (main): Include decompress.c support.
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.*/)
63 ptrdiff_t count = SPECPDL_INDEX (); 63 ptrdiff_t count = SPECPDL_INDEX ();
64 64
65 validate_region (&start, &end); 65 validate_region (&start, &end);
66 move_gap_both (iend, iend);
67 66
68 if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) 67 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
69 error ("This function can only be called in unibyte buffers"); 68 error ("This function can only be called in unibyte buffers");
@@ -72,6 +71,7 @@ This function can only be called in unibyte buffers.*/)
72 the same. */ 71 the same. */
73 istart = XINT (start); 72 istart = XINT (start);
74 iend = XINT (end); 73 iend = XINT (end);
74 move_gap_both (iend, iend);
75 75
76 stream.zalloc = Z_NULL; 76 stream.zalloc = Z_NULL;
77 stream.zfree = Z_NULL; 77 stream.zfree = Z_NULL;
@@ -99,13 +99,11 @@ This function can only be called in unibyte buffers.*/)
99 99
100 /* Run inflate() on input until the output buffer isn't full. */ 100 /* Run inflate() on input until the output buffer isn't full. */
101 do { 101 do {
102 int result;
102 stream.avail_out = BUFFER_SIZE; 103 stream.avail_out = BUFFER_SIZE;
103 stream.next_out = out; 104 stream.next_out = out;
104 switch (inflate (&stream, Z_NO_FLUSH)) { 105 result = inflate (&stream, Z_NO_FLUSH);
105 case Z_STREAM_ERROR: 106 if (result < 0) {
106 case Z_NEED_DICT:
107 case Z_DATA_ERROR:
108 case Z_MEM_ERROR:
109 unbind_to (count, Qnil); 107 unbind_to (count, Qnil);
110 return Qnil; 108 return Qnil;
111 } 109 }