]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language Python, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Mar 2023 19:48:35 +0000 (20:48 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 7 Mar 2023 15:59:25 +0000 (16:59 +0100)
commitba0312e351afc72723ca5e8d6bd3bc33622288ac
tree14ca8cdc73c84d6c0933a176c94879780eba085e
parenta6636c9a310a50cef71710008a7ff4bd62fe2b31
xgettext: In language Python, avoid stack overflow.

* gettext-tools/src/x-python.c (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_python): Initialize paren_nesting_depth and bracket_nesting_depth.
* gettext-tools/tests/xgettext-python-stackovfl-1: New file.
* gettext-tools/tests/xgettext-python-stackovfl-2: New file.
* gettext-tools/tests/xgettext-python-stackovfl-3: New file.
* gettext-tools/tests/xgettext-python-stackovfl-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-python.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-python-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-python-stackovfl-2 [new file with mode: 0755]
gettext-tools/tests/xgettext-python-stackovfl-3 [new file with mode: 0755]
gettext-tools/tests/xgettext-python-stackovfl-4 [new file with mode: 0755]