public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: ignore NUL byte on write in xterm emulation mode as well Date: Thu, 20 Feb 2020 16:04:00 -0000 [thread overview] Message-ID: <20200220160419.95609.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c9f153580bfb4db4f9ef023b99360d7a746bd450 commit c9f153580bfb4db4f9ef023b99360d7a746bd450 Author: Corinna Vinschen <corinna@vinschen.de> Date: Thu Feb 20 14:48:03 2020 +0100 Cygwin: console: ignore NUL byte on write in xterm emulation mode as well A NUL byte in the output stream got accidentally not handled as IGN char in xterm console mode. The internal mbtowc conversion doesn't handle embedded NUL values gracefully, it always stops converting at NUL bytes. This broke the output of strings with embedded NUL bytes. Fix this by always skipping IGN chars in the "normal char output loop" and make sure not to move the cursor one position to the right, as in legacy console mode. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/fhandler_console.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 66e645a..c062fd7 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -2641,6 +2641,7 @@ fhandler_console::write_normal (const unsigned char *src, memset (&ps, 0, sizeof ps); while (found < end && found - src < CONVERT_LIMIT + && base_chars[*found] != IGN && ((wincap.has_con_24bit_colors () && !con_is_legacy) || base_chars[*found] == NOR) ) { @@ -2732,7 +2733,8 @@ do_print: cursor_rel (-1, 0); break; case IGN: - cursor_rel (1, 0); + if (!wincap.has_con_24bit_colors () || con_is_legacy) + cursor_rel (1, 0); break; case CR: cursor_get (&x, &y);
reply other threads:[~2020-02-20 16:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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 * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200220160419.95609.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).