On Mon, Jan 6, 2020 at 3:52 AM Hans Leidekker <hans(a)codeweavers.com> wrote:
On Fri, 2020-01-03 at 17:08 -0700, Erich E. Hoover wrote:
... + ret = 0; ...
'ret' is a pointer.
Ack, sorry about that - supposed to be setting the value.
... + for (i = 0; i < len; i++) { - if (exp & 1) exp_val *= exp_mul; - exp_mul *= exp_mul; + if (p[i] >= '0' && p[i] <= '9') continue; + if (p[i] != 'e' && p[i] != 'E' && p[i] != '.' && p[i] != '+' && p[i] != '-') + return WS_E_INVALID_FORMAT; }
Is this part really necessary?
Technically sscanf supports more than what the reader does, but it does pass all the current tests without this check. For example, scanf supports the Fortran-style "d" exponent notation (for msvcr < 140). If you would like I can fold the +/-/. weirdness into this, which does have tests, possibly something like: === for (i = 0; i < len; i++) { if (p[i] >= '0' && p[i] <= '9') { found_digit = TRUE; continue; } if (p[i] != 'e' && p[i] != 'E' && p[i] != '.' && p[i] != '+' && p[i] != '-') return WS_E_INVALID_FORMAT; } if (!found_digit) { *ret = 0; return S_OK; } ===
I also get new failures with a non-mingw build: ... Looks like scanf returns a different result for %n in this case. It probably shouldn't block this patch though.
That's interesting, if you like I could move the length check into the format checker so that it does not rely on scanf for that to work properly. Best, Erich