This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/23274] New: scanf of 100ergs done wrong


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

            Bug ID: 23274
           Summary: scanf of 100ergs done wrong
           Product: glibc
           Version: 2.27
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: tydeman.fred at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

scanf does just one character lookahead.  Therefore, scanf using %f of
"100ergs" should be a matching failure.  This has existed since C89.  The words
in the current C17 standard (same as in C99) are:  7.21.6.2 The fscanf function
Paragraph 9: An input item is defined as the longest sequence of input
characters which does not exceed any specified field width and which is, or is
a prefix of, a matching input sequence.291) The first character, if any, after
the input item remains unread.

291) fscanf pushes back at most one input character onto the input stream.
Therefore, some sequences that are acceptable to strtod, strtol, etc., are
unacceptable to fscanf

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]