From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 82E32385803D; Thu, 4 Nov 2021 19:32:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82E32385803D From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NUL character on state reset Date: Thu, 04 Nov 2021 19:32:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 2.35 X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: target_milestone resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2021 19:32:50 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28524 Florian Weimer changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.35 Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #2 from Florian Weimer --- Fixed for glibc 2.35 via: commit ff012870b2c02a62598c04daa1e54632e020fd7d Author: Nikita Popov Date: Tue Nov 2 13:21:42 2021 +0500 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 !=3D 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) !=3D 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 --=20 You are receiving this mail because: You are on the CC list for the bug.=