https://issues.dlang.org/show_bug.cgi?id=13541

--- Comment #4 from Vladimir Panteleev <thecybersha...@gmail.com> ---
(In reply to Walter Bright from comment #0)
> This should be an assert because:
> 
> 1. sysErrorString()'s argument should ONLY be values returned by Windows
> APIs like GetLastError(), and so this should always succeed.

No, it may fail. Windows exposes a SetLastError API, which allows setting error
codes which may not be valid. Third-party libraries may use SetLastError to set
the error code to a private one, which sysErrorString may fail to parse.

> 2. recursively calling sysErrorString() with the SAME value will cause a
> stack overflow crash, not any usable exception.

No, sysErrorString is not recursing "with the SAME value". It is recursing with
the value from FormatMessageW, which we can expect to be valid.

--

Reply via email to