public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/31183] New: Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix
@ 2023-12-20 15:43 fweimer at redhat dot com
  2023-12-20 15:43 ` [Bug stdio/31183] " fweimer at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2023-12-20 15:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31183

            Bug ID: 31183
           Summary: Wide stream buffer size reduced MB_LEN_MAX bytes after
                    bug 17522 fix
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: fweimer at redhat dot com
          Reporter: fweimer at redhat dot com
  Target Milestone: ---

After the fix from bug 17522, we do not use the remaining buffer space if the
already-written buffer space is smaller than MB_LEN_MAX (16 bytes).  As we
start out with no written bytes (zero), we never use the full buffer, greatly
reducing performance.

The fix probably explains it better:

-         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.  */
              write_ptr = write_base = mb_buf;
              buf_end = mb_buf + sizeof (mb_buf);
            }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug stdio/31183] Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix
  2023-12-20 15:43 [Bug stdio/31183] New: Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix fweimer at redhat dot com
@ 2023-12-20 15:43 ` fweimer at redhat dot com
  2023-12-20 16:17 ` fweimer at redhat dot com
  2024-01-02 13:43 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2023-12-20 15:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31183

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
              Flags|                            |security-
                 CC|                            |fweimer at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug stdio/31183] Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix
  2023-12-20 15:43 [Bug stdio/31183] New: Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix fweimer at redhat dot com
  2023-12-20 15:43 ` [Bug stdio/31183] " fweimer at redhat dot com
@ 2023-12-20 16:17 ` fweimer at redhat dot com
  2024-01-02 13:43 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2023-12-20 16:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31183

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Patch posted:

[PATCH] libio: Check remaining buffer size in _IO_wdo_write (bug 31183)
<https://inbox.sourceware.org/libc-alpha/87bkakx3b0.fsf@oldenburg.str.redhat.com/>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug stdio/31183] Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix
  2023-12-20 15:43 [Bug stdio/31183] New: Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix fweimer at redhat dot com
  2023-12-20 15:43 ` [Bug stdio/31183] " fweimer at redhat dot com
  2023-12-20 16:17 ` fweimer at redhat dot com
@ 2024-01-02 13:43 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2024-01-02 13:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31183

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |2.39

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
Fixed for 2.39 via:

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)").

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-02 13:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 15:43 [Bug stdio/31183] New: Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix fweimer at redhat dot com
2023-12-20 15:43 ` [Bug stdio/31183] " fweimer at redhat dot com
2023-12-20 16:17 ` fweimer at redhat dot com
2024-01-02 13:43 ` fweimer at redhat dot com

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).