From b4a3be43850ed770a06b94d96c77b27346b828b9 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 30 Oct 2001 16:35:42 +0000 Subject: [PATCH] (to_multibyte): Ensure read_buffer is at least twice as large as the number of bytes to convert. --- src/ChangeLog | 3 +++ src/lread.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0eb9c31220d..db1539af6f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2001-10-30 Gerd Moellmann + * lread.c (to_multibyte): Ensure read_buffer is at least twice + as large as the number of bytes to convert. + * lread.c (to_multibyte): New function. (read1): Use it. diff --git a/src/lread.c b/src/lread.c index 59e84105a39..072de3a98ec 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1790,7 +1790,7 @@ to_multibyte (p, end, nchars) int nbytes; parse_str_as_multibyte (read_buffer, *p - read_buffer, &nbytes, nchars); - if (nbytes > read_buffer_size) + if (read_buffer_size < 2 * nbytes) { int offset = *p - read_buffer; read_buffer_size *= 2; @@ -2239,6 +2239,9 @@ read1 (readcharfun, pch, first_in_list) if (c < 0) end_of_file_error (); + if (p - read_buffer == 24183) + fprintf (stderr, "hello\n"); + /* If purifying, and string starts with \ newline, return zero instead. This is for doc strings that we are really going to find in etc/DOC.nn.nn */ -- 2.39.5