diff options
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 | } |