diff options
| author | Kenichi Handa | 1998-06-22 00:24:57 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-06-22 00:24:57 +0000 |
| commit | 55fd504836ce37e25e2ccc208463e6f1877d6f7f (patch) | |
| tree | 17cc5ad435c214172d5d9e8d48128408e11c1a07 /src/process.c | |
| parent | 52fd88d3c4a1a3e07b697508010c5526bf750340 (diff) | |
| download | emacs-55fd504836ce37e25e2ccc208463e6f1877d6f7f.tar.gz emacs-55fd504836ce37e25e2ccc208463e6f1877d6f7f.zip | |
(read_process_output): While processing carryover,
check the size of p->decoding_buf.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c index 814fbc4a747..d76cebe5e12 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2855,13 +2855,19 @@ read_process_output (proc, channel) | |||
| 2855 | carryover = nbytes - coding->consumed; | 2855 | carryover = nbytes - coding->consumed; |
| 2856 | if (carryover > 0) | 2856 | if (carryover > 0) |
| 2857 | { | 2857 | { |
| 2858 | /* We must move the data carried over to the tail of | 2858 | /* Copy the carryover bytes to the end of p->decoding_buf, to |
| 2859 | decoding buffer. We are sure that the size of decoding | 2859 | be processed on the next read. Since decoding_buffer_size |
| 2860 | buffer (decided by decoding_buffer_size) is large enough | 2860 | asks for an extra amount of space beyond the maximum |
| 2861 | to contain them. */ | 2861 | expected for the output, there should always be sufficient |
| 2862 | bcopy (chars + nbytes - carryover, | 2862 | space for the carryover (which is by definition a sequence |
| 2863 | (XSTRING (p->decoding_buf)->data | 2863 | of bytes that was not long enough to be decoded, and thus |
| 2864 | + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover), | 2864 | has a bounded length). */ |
| 2865 | if (STRING_BYTES (XSTRING (p->decoding_buf)) | ||
| 2866 | < coding->produced + carryover) | ||
| 2867 | abort (); | ||
| 2868 | bcopy (chars + coding->consumed, | ||
| 2869 | XSTRING (p->decoding_buf)->data | ||
| 2870 | + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover, | ||
| 2865 | carryover); | 2871 | carryover); |
| 2866 | XSETINT (p->decoding_carryover, carryover); | 2872 | XSETINT (p->decoding_carryover, carryover); |
| 2867 | } | 2873 | } |