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

Resolves: RHEL-19824
This commit is contained in:
Florian Weimer 2024-01-02 15:15:37 +01:00
parent 2a2d048539
commit 95743a650a
2 changed files with 32 additions and 1 deletions

27
glibc-RHEL-19824.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 d3deb34ba058ca39..6a6421f8880f9356 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

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.28
%define glibcversion 2.28
%define glibcrelease 247%{?dist}
%define glibcrelease 248%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -1177,6 +1177,7 @@ Patch989: glibc-RHEL-15696-109.patch
Patch990: glibc-RHEL-15696-110.patch
Patch991: glibc-RHEL-17468-1.patch
Patch992: glibc-RHEL-17468-2.patch
Patch993: glibc-RHEL-19824.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -3008,6 +3009,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Tue Jan 2 2024 Florian Weimer <fweimer@redhat.com> - 2.28-248
- Re-enable output buffering for wide stdio streams (RHEL-19824)
* Thu Dec 21 2023 Carlos O'Donell <carlos@redhat.com> - 2.28-247
- Fix TLS corruption during dlopen()/dlclose() sequences (RHEL-17468)