public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/28828] New: fputwc crashes
@ 2022-01-27 13:01 jobol at nonadev dot net
  2022-01-27 13:04 ` [Bug stdio/28828] " jobol at nonadev dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jobol at nonadev dot net @ 2022-01-27 13:01 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 28828
           Summary: fputwc crashes
           Product: glibc
           Version: 2.33
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: jobol at nonadev dot net
  Target Milestone: ---

Created attachment 13933
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13933&action=edit
short program

on amd64, debian.

the program b.c attached (and listed below). Crashes with SIGSEGV in the first
fputwc.

It does not crashes if I comment the line 8.


 1: #include <stdio.h>
 2: #include <wchar.h>
 3: int main(int ac, char **av)
 4: {
 5:         wint_t c;
 6: 
 7:         setvbuf(stdin, NULL, _IOLBF, 0);
 8:         setvbuf(stdout, NULL, _IOLBF, 0);
 9:         c = fgetwc(stdin);
10:         fputwc(c, stdout);
11:         fputwc(10, stdout);
12:         return 0;
13: }

-- 
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/28828] fputwc crashes
  2022-01-27 13:01 [Bug stdio/28828] New: fputwc crashes jobol at nonadev dot net
@ 2022-01-27 13:04 ` jobol at nonadev dot net
  2022-03-08 17:26 ` cvs-commit at gcc dot gnu.org
  2022-03-08 17:27 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jobol at nonadev dot net @ 2022-01-27 13:04 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from José Bollo <jobol at nonadev dot net> ---
also, when I insert "fputwc(10, stdout);" between lines 8 and 9, the crash does
not happen.

-- 
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/28828] fputwc crashes
  2022-01-27 13:01 [Bug stdio/28828] New: fputwc crashes jobol at nonadev dot net
  2022-01-27 13:04 ` [Bug stdio/28828] " jobol at nonadev dot net
@ 2022-03-08 17:26 ` cvs-commit at gcc dot gnu.org
  2022-03-08 17:27 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-08 17:26 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Adhemerval Zanella
<azanella@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=edc696a73a7cb07b1aa68792a845a98d036ee7eb

commit edc696a73a7cb07b1aa68792a845a98d036ee7eb
Author: José Bollo <jobol@nonadev.net>
Date:   Tue Mar 8 09:58:16 2022 +0100

    libio: Ensure output buffer for wchars (bug #28828)

    The _IO_wfile_overflow does not check if the write pointer for wide
    data is valid before access, different than _IO_file_overflow.  This
    leads to crash on some cases, as described by bug 28828.

    The minimal sequence to produce the crash was:

      #include <stdio.h>
      #include <wchar.h>
      int main (int ac, char **av)
      {
        setvbuf (stdout, NULL, _IOLBF, 0);
        fgetwc (stdin);
        fputwc (10, stdout); /*CRASH HERE!*/
        return 0;
      }

    The "fgetwc(stdin);" is necessary since it triggers the bug by setting
    the flag _IO_CURRENTLY_PUTTING on stdout indirectly (file wfileops.c,
    function _IO_wfile_underflow, line 213).

    Signed-off-by: Jose Bollo <jobol@nonadev.net>

-- 
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/28828] fputwc crashes
  2022-01-27 13:01 [Bug stdio/28828] New: fputwc crashes jobol at nonadev dot net
  2022-01-27 13:04 ` [Bug stdio/28828] " jobol at nonadev dot net
  2022-03-08 17:26 ` cvs-commit at gcc dot gnu.org
@ 2022-03-08 17:27 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2022-03-08 17:27 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
   Target Milestone|---                         |2.36
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.36.

-- 
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:[~2022-03-08 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 13:01 [Bug stdio/28828] New: fputwc crashes jobol at nonadev dot net
2022-01-27 13:04 ` [Bug stdio/28828] " jobol at nonadev dot net
2022-03-08 17:26 ` cvs-commit at gcc dot gnu.org
2022-03-08 17:27 ` adhemerval.zanella at linaro dot org

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