[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How does string.format handle undefined behavior?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 27 Aug 2021 11:28:11 -0300
> Yes, and I've found a few places where it accepts strings which cause
> undefined behavior:
> If precision is specified for conversion specifiers other than d, i,
> o, u, x, X, a, A, e, E, f, F, g, G, and s.
> If the '#' flag is specified for conversion specifiers other than o,
> x, X, a, A, e, E, f, F, g, and G.
> If the '0' flag is specified for conversion specifiers other than d,
> i, o, x, X, a, A, e, E, f, F, g, and G.
>
> And from testing them on my machine,
> string.format("%02c",string.byte"1") results in "01", so it isn't
> ignored.
Thanks for the report. Do you have any real case where this is causing
problems? (e.g., a platform with a weird behavior for these uses, a tool
that complains about Lua source code.)
-- Roberto