JLSEC-2026-2267: Calling the ungetwc function on a FILE stream with wide characters encoded in a character set...
Calling the ungetwc function on a FILE stream with wide characters encoded in a character set that has overlaps between its single byte and multi-byte character encodings, in the GNU C Library version 2.43 or earlier, may result in an attempt to read bytes before an allocated buffer, potentially resulting in unintentional disclosure of neighboring data in the heap, or a program crash.
A bug in the wide character pushback implementation (IOwdefaultpbackfail in libio/wgenops.c) causes ungetwc() to operate on the regular character buffer (fp->IOreadptr) instead of the actual wide-stream read pointer (fp->widedata->IOreadptr). The program crash may happen in cases where fp->IOreadptr is not initialized and hence points to NULL. The buffer under-read requires a special situation where the input character encoding is such that there are overlaps between single byte representations and multibyte representations in that encoding, resulting in spurious matches. The spurious match case is not possible in the standard Unicode character sets.
Affected Software
Event History
Child vulnerabilities
Contains the following vulnerabilities.
Frequently Asked Questions
Which deployments are realistically exposed to the buffer under-read and potential heap disclosure?
The under-read requires use of ungetwc() on a wide-character FILE stream with a character encoding that overlaps single-byte and multibyte representations. This spurious-match condition is not possible with standard Unicode character sets.
Can the issue cause a denial of service even when the special encoding condition is not met?
Yes. A program crash can occur when the regular stream read pointer, fp->_IO_read_ptr, is uninitialized and points to NULL.
What must an attacker be able to do to exploit this issue?
The affected program must call ungetwc() on a wide-character stream using a character set with overlapping single-byte and multibyte encodings for the disclosure scenario. The supplied data does not identify any required authentication or user interaction.
Which GNU C Library versions are affected?
GNU C Library version 2.43 and earlier are identified as affected.