mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-26 19:16:41 +00:00
The C standard states that, in the context of an x conversion
specifier given to scanf:
> Matches an optionally signed hexadecimal integer, whose format is
> the same as expected for the subject sequence of the strtoul
> function with the value 16 for the base argument.
- C standard, 7.23.6.2.11. The fscanf function
Cosmopolitan fails to do this, as 0 should be parsed as a 0 by such an
invocation of strtoul. Instead, cosmopolitan errors out as though such
input is invalid, which is wrong.
This means that a program such as this:
#include <stdio.h>
#undef NDEBUG
#include <assert.h>
int main()
{
int v = 0;
assert(sscanf("0", "%x", &v) == 1);
}
will not run correctly on cosmpolitan, instead failing the assertion.
This patch fixes this, along with the associated GitHub issue,
https://github.com/jart/cosmopolitan/issues/778
|
||
|---|---|---|
| .. | ||
| 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 | ||