[vlc-devel] [PATCH] vlc_strftime: avoid infinite loop on windows when format string is invalid
pierre at videolabs.io
Thu Jan 25 16:09:34 CET 2018
> Since strftime() returning 0 does not necessarily indicate an error,
> errno should be set to 0 before the call (otherwise, it may contain
> garbage value).
Even if not documented, windows set errno to ERANGE in the case that interest
us. I think we should rather check for this value, this will cover other error
cases (source: wine implementation)
> But I think this corner case is not handled correctly anyway in this
> function. "man strftime" says:
> > For example, in many locales %p yields an empty string.
the man states in the BUG section that
> it impossible to distinguish this error case from cases where the format
string legitimately produces a zero-length output string.
so I don't see what we can do here....
glibc implementation allows to retreive the number of char to be written by
setting the output buffer to NULL, but I'm not sure it's a good idea to rely
More information about the vlc-devel