From 2d3f09544895b422eeecf89e0d108da8b8fcdfca Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 12 Apr 2019 11:48:24 -0300 Subject: Avoid using large buffers in 'string.format' The result of "string.format("%.99f", -1e308) is 410 characters long, but all other formats have much smaller limits (at most 99 plus a fex extras). This commit avoids 'string.format' asking for a buffer ~400 chars large when ~100 will do. --- luaconf.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'luaconf.h') diff --git a/luaconf.h b/luaconf.h index 5c714d4e..76a61616 100644 --- a/luaconf.h +++ b/luaconf.h @@ -709,16 +709,9 @@ /* @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -** CHANGE it if it uses too much C-stack space. (For long double, -** 'string.format("%.99f", -1e4932)' needs 5052 bytes, so a -** smaller buffer would force a memory allocation for each call to -** 'string.format'.) */ -#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE -#define LUAL_BUFFERSIZE 8192 -#else #define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) -#endif + /* @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure -- cgit v1.2.3-55-g6feb