[Tarantool-patches] [PATCH luajit] Fix os.date() for wider libc strftime() compatibility.

Igor Munkin imun at tarantool.org
Mon Feb 20 12:57:34 MSK 2023


Sergey,

I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in master, 2.10 and 1.10.

On 01.02.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
> 
> Thanks to Jesper Lundgren.
> 
> (cherry picked from commit fc63c938b522e147ea728b75f385728bf4a8fc35)
> 
> When `strftime()` returns empty result (for example, for "%p" on some
> locales or when LuaJIT is built with musl's `strftime()` and format
> string is invalid), the `os.date()` endless retries to format result
> and reallocates buffer for resulting string. This leads to OOM.
> 
> This patch limits amount of retries by 4.
> 
> Sergey Kaplun:
> * added the description and the test for the problem
> 
> Part of tarantool/tarantool#8069
> ---
> 
> PR: https://github.com/tarantool/tarantool/pull/8237
> Issues:
> * https://github.com/LuaJIT/LuaJIT/issues/463
> * https://github.com/tarantool/tarantool/issues/8069
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-463-os-date-oom-full-ci
> 
>  src/lib_os.c                                  |  4 ++--
>  .../lj-463-os-date-oom.test.lua               | 19 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 2 deletions(-)
>  create mode 100644 test/tarantool-tests/lj-463-os-date-oom.test.lua
> 

<snipped>

> -- 
> 2.34.1
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list