lua-users home
lua-l archive

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


On 20 November 2015 at 00:05, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> I don't suppose you have some solution to
>> http://lua-users.org/lists/lua-l/2015-07/msg00540.html ?
>> I was hoping it might have made it into this release.
>
> What is the issue here? What would be the "correct" behavior? The
> documentation is clear that "Option 's' expects a string without
> embedded zeros" [1].
>
> [1] http://www.lua.org/manual/5.3/manual.html#pdf-string.format
>
> -- Roberto
>

Heh, I just ran into this via a failing test (
https://travis-ci.org/daurnimator/lua-http/builds/93146257 ):
I was using `string.format("%x\r\n%s\r\n", #chunk, chunk)` to create a
chunk for the HTTP 1.1 "chunked" encoding; however chunks can contain
nulls.

It was only caught due to one of the tests happening to have a gzip
body that compressed to a string that contained a null....
I'm willing to bet that there's plenty of code out there that fails
due to %s not respecting embedded nulls.
Hence I think it's something worth fixing in lua itself.