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/17829] New: Incorrect handling of precision specifier in printf family


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

            Bug ID: 17829
           Summary: Incorrect handling of precision specifier in printf
                    family
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: nfxjfg at googlemail dot com
                CC: drepper.fsp at gmail dot com

The following program shows no output:

#include <stdio.h>
#include <limits.h>

int main(int argc, char **argv)
{
    printf("%.*s\n", INT_MAX, "hi");
    return 0;
}

The precision given is INT_MAX; this should turn the precision specifier into a
no-OP, equivalent to 'printf("%s\n", "hi");'. Making the precision value
somewhat lower seems to make it work.

snprintf() seems to have a similar issue, but the failure seems to start with
even lower precision values.

Other libcs handle this correctly (I tested mingw-w64 and musl).

Using glibc 2.19-13 on Debian 32 bit x86.

-- 
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]