Re-enable output buffering for wide stdio streams (RHEL-19862)

Resolves: RHEL-19862
This commit is contained in:
Florian Weimer 2024-01-02 15:18:37 +01:00
parent 806a394144
commit 178dfa8115
2 changed files with 32 additions and 1 deletions

27
glibc-RHEL-19862.patch Normal file
View File

@ -0,0 +1,27 @@
commit ecc7c3deb9f347649c2078fcc0f94d4cedf92d60
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jan 2 14:36:17 2024 +0100
libio: Check remaining buffer size in _IO_wdo_write (bug 31183)
The multibyte character needs to fit into the remaining buffer space,
not the already-written buffer space. Without the fix, we were never
moving the write pointer from the start of the buffer, always using
the single-character fallback buffer.
Fixes commit 04b76b5aa8b2d1d19066e42dd1 ("Don't error out writing
a multibyte character to an unbuffered stream (bug 17522)").
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 37f44780f811bd38..6cbc3c7c968f9136 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -57,7 +57,7 @@ _IO_wdo_write (FILE *fp, const wchar_t *data, size_t to_do)
char mb_buf[MB_LEN_MAX];
char *write_base, *write_ptr, *buf_end;
- if (fp->_IO_write_ptr - fp->_IO_write_base < sizeof (mb_buf))
+ if (fp->_IO_buf_end - fp->_IO_write_ptr < sizeof (mb_buf))
{
/* Make sure we have room for at least one multibyte
character. */

View File

@ -155,7 +155,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 96%{?dist}
Release: 97%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -799,6 +799,7 @@ Patch562: glibc-RHEL-17319-3.patch
Patch563: glibc-RHEL-17319-4.patch
Patch564: glibc-RHEL-17465-1.patch
Patch565: glibc-RHEL-17465-2.patch
Patch566: glibc-RHEL-19862.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2957,6 +2958,9 @@ update_gconv_modules_cache ()
%endif
%changelog
* Tue Jan 2 2024 Florian Weimer <fweimer@redhat.com> - 2.34-97
- Re-enable output buffering for wide stdio streams (RHEL-19862)
* Thu Dec 21 2023 Carlos O'Donell <carlos@redhat.com> - 2.34-96
- Fix TLS corruption during dlopen()/dlclose() sequences (RHEL-17465)