lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


No, I just noticed it while reading the definition of the fprintf
function. Most platforms will probably handle them fine, but the
results may vary between the platforms (I've only tested the results
on my machine). They should probably be ignored or generate an error
in string.format, but accepting them is probably ok for all
significant platforms.

On Fri, Aug 27, 2021 at 10:29 AM Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>
> > 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