]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language Lua, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Wed, 8 Mar 2023 20:37:57 +0000 (21:37 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 9 Mar 2023 10:40:25 +0000 (11:40 +0100)
commitdb16c08cfe9f12150c8ca107796841f0185a3e44
tree4cacdffc0174af17ed4607311a44f022da960a3a
parentcd298b41029697bd50906b1c3dded2501fb0f8b6
xgettext: In language Lua, avoid stack overflow.

* gettext-tools/src/x-lua.c: Include error-progname.h.
(MAX_NESTING_DEPTH): New macro.
(paren_nesting_depth, bracket_nesting_depth): New variables.
(extract_balanced): Increase and check paren_nesting_depth or
bracket_nesting_depth before calling extract_balanced recursively.
(extract_lua): Initialize paren_nesting_depth and bracket_nesting_depth.
* gettext-tools/tests/xgettext-lua-stackovfl-1: New file.
* gettext-tools/tests/xgettext-lua-stackovfl-2: New file.
* gettext-tools/tests/xgettext-lua-stackovfl-3: New file.
* gettext-tools/tests/xgettext-lua-stackovfl-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-lua.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-lua-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-lua-stackovfl-2 [new file with mode: 0755]
gettext-tools/tests/xgettext-lua-stackovfl-3 [new file with mode: 0755]
gettext-tools/tests/xgettext-lua-stackovfl-4 [new file with mode: 0755]