From: charles@aurox.ch (Charles A. Roelli)
To: jidanni@jidanni.org
Cc: 6149@debbugs.gnu.org
Subject: bug#6149: 24.0.50; shell buffer overflow when input longer than 4096 bytes
Date: Fri, 28 Sep 2018 22:13:11 +0200 [thread overview]
Message-ID: <m25zyp2xew.fsf@aurox.ch> (raw)
In-Reply-To: <87aas81jgh.fsf@jidanni.org>
> From: jidanni@jidanni.org
> Date: Mon, 10 May 2010 12:14:54 +0800
>
> This is a serious bug in M-x shell. It is not a bash or dash bug. It is
> not a readline bug. It does not happen in xterm. It does not happen when
> using pipes or backticks to get the input. It only happens in M-x
> shell... when one gives lines longer than ~4096 characters.
>
> Actually it is not buffer overflow, but buffer truncation, with NO
> WARNING to the user. One day the wrong file will get removed via this
> mess.
>
> In GNU Emacs 24.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
> of 2010-05-01 on elegiac, modified by Debian
> (emacs-snapshot package, version 1:20100501-1)
>
>
> [application/octet-stream input_truncation.txt.gz (2kB)]
I can still reproduce this bug in 26.1 with the following recipe:
M-x shell RET
echo SPC C-SPC
C-u 5000 a RET
C-p C-e
M-=
On GNU/Linux: Region has 2 lines, 2 words, and 9096 characters.
If echo had received all of the input, you would expect around 10000
characters in the region. Instead, there are 5000 + 4096 characters.
Back when EOF chars were used to flush output, we had an "fpathconf"
check as in:
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3d082a269ece18058ed82957f8a056822b39789e
It might be possible to reinstate this "fpathconf" check to warn the
user that he has gone over the PTY limit, or maybe to prevent overlong
lines from being sent at all.
There is further discussion at:
http://lists.gnu.org/archive/html/emacs-devel/2010-08/msg00209.html
(Also, repeating this recipe on macOS with Emacs 26.1 results in the
behavior pointed out in Bug#32438.)
prev parent reply other threads:[~2018-09-28 20:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-10 4:14 bug#6149: 24.0.50; shell buffer overflow when input longer than 4096 bytes jidanni
2010-06-01 1:50 ` Stefan Monnier
2023-07-20 20:15 ` bug#6149: bug#24531: process-send-string seems to truncate lines over 4096 characters Spencer Baugh
2023-07-20 21:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-21 5:39 ` Eli Zaretskii
2023-07-21 13:58 ` Spencer Baugh
2023-07-21 14:18 ` Eli Zaretskii
2023-07-27 1:48 ` bug#6149: " Dmitry Gutov
2023-07-27 5:41 ` Eli Zaretskii
2023-07-27 13:59 ` Spencer Baugh
2023-07-27 14:51 ` Paul Eggert
2023-07-21 15:09 ` bug#24531: " Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2018-09-28 20:13 ` Charles A. Roelli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m25zyp2xew.fsf@aurox.ch \
--to=charles@aurox.ch \
--cc=6149@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).