public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "Никита Попов" <npv1310@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3 (bug 28524)
Date: Thu, 04 Nov 2021 20:34:08 +0100	[thread overview]
Message-ID: <87y26390lr.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CA+cA0PB6J-9JddvAUg=GhHm6ibX7iatD-p+ZvucRPPVG9wtXMA@mail.gmail.com> (=?utf-8?B?ItCd0LjQutC40YLQsCDQn9C+0L/QvtCyIidz?= message of "Thu, 4 Nov 2021 20:03:21 +0500")

* Никита Попов:

> From d8321b3b4399a6e1999bd0ebd1466f6235dc5630 Mon Sep 17 00:00:00 2001
> From: Nikita Popov <npv1310@gmail.com>
> Date: Tue, 2 Nov 2021 13:21:42 +0500
> Subject: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3
>  (bug 28524)
>
> Bugfix 27256 has introduced another issue:
> In conversion from ISO-2022-JP-3 encoding, it is possible
> to force iconv to emit extra NUL character on internal state reset.
> To do this, it is sufficient to feed iconv with escape sequence
> which switches active character set.
> The simplified check 'data->__statep->__count != ASCII_set'
> introduced by the aforementioned bugfix picks that case and
> behaves as if '\0' character has been queued thus emitting it.
>
> To eliminate this issue, these steps are taken:
> * Restore original condition
> '(data->__statep->__count & ~7) != ASCII_set'.
> It is necessary since bits 0-2 may contain
> number of buffered input characters.
> * Check that queued character is not NUL.
> Similar step is taken for main conversion loop.
>
> Bundled test case follows following logic:
> * Try to convert ISO-2022-JP-3 escape sequence
> switching active character set
> * Reset internal state by providing NULL as input buffer
> * Ensure that nothing has been converted.
>
> Signed-off-by: Nikita Popov <npv1310@gmail.com>

Thanks, applied.

Florian


      reply	other threads:[~2021-11-04 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  9:06 Никита Попов
2021-11-03  4:20 ` Никита Попов
2021-11-04 14:10 ` Florian Weimer
2021-11-04 14:32 ` Florian Weimer
2021-11-04 15:03   ` Никита Попов
2021-11-04 19:34     ` Florian Weimer [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y26390lr.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=npv1310@gmail.com \
    /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.
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).