mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
12e07798df
The C standard, when defining field width and precision, never gives any limit on the values used for them (except, I believe, that they fit within an int). In other words, if the user gives a field width of 32145 and a precision of 9218, the implementation has to handle these values correctly. However, when such kinds of high numbers are used with integer conversions, cosmopolitan is limited by an internal buffer size of 144, which means precisions and field widths have to fit within this, which violates the standard. This means that for example, the following program: #include <stdio.h> #include <string.h> int main() { char buf2[512] = {}; int i = snprintf(buf2, sizeof(buf2), "%.9999u", 10); printf("%d %zu\n", i, strlen(buf2)); } would, instead of printing "9999 511" (the correct output), instead print "144 144" under cosmopolitan. This patch fixes this. |
||
---|---|---|
.. | ||
atoi_test.c | ||
basename_test.c | ||
dirname_test.c | ||
encodenf32_test.c | ||
fmt_test.c | ||
formatbinary64_test.c | ||
formatflex64_test.c | ||
formathex64_test.c | ||
formatint64_test.c | ||
formatint64thousands_test.c | ||
formatoctal32_test.c | ||
formatoctal64_test.c | ||
fprintf_test.c | ||
imaxdiv_test.c | ||
itoa64radix16_test.c | ||
joinpaths_test.c | ||
lengthuint64_test.c | ||
palandprintf_test.c | ||
printf_uppercase_e_static_yoink_test.c | ||
printf_uppercase_f_static_yoink_test.c | ||
printf_uppercase_g_static_yoink_test.c | ||
sizetol_test.c | ||
sleb128_test.c | ||
snprintf_test.c | ||
sprintf_s.inc | ||
sprintf_s_test.c | ||
sscanf_test.c | ||
strerror_r_test.c | ||
stripexts_test.c | ||
test.mk | ||
timevaltofiletime_test.c | ||
uleb64_test.c | ||
uleb128_test.c | ||
zleb64_test.c |