This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/17829] Incorrect handling of precision specifier in printf family
- From: "cherepan at mccme dot ru" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 07 Jan 2016 18:46:07 +0000
- Subject: [Bug stdio/17829] Incorrect handling of precision specifier in printf family
- Auto-submitted: auto-generated
- References: <bug-17829-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17829
--- Comment #7 from Alexander Cherepanov <cherepan at mccme dot ru> ---
1. The same problem with the width. Consider the program:
#include <stdio.h>
#include <errno.h>
int main()
{
int res = printf("%2147483647d", 1);
fprintf(stderr, "res = %d, errno = %d\n", res, errno);
}
printf should succeed but it fails: "res = -1, errno = 75". There are
two problematic checks similar to the one for precision:
https://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/vfprintf.c;h=6829d4dc8e7fe7c066a06f1857ee926e0f48c379;hb=HEAD#l1459
https://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/vfprintf.c;h=6829d4dc8e7fe7c066a06f1857ee926e0f48c379;hb=HEAD#l1491
2. When the width is taken from an argument via asterisk, INT_MIN is not
handled properly -- signed integer overflow:
1451 /* Negative width means left justified. */
1452 if (width < 0)
1453 {
1454 width = -width;
1455 pad = L_(' ');
1456 left = 1;
1457 }
--
You are receiving this mail because:
You are on the CC list for the bug.