]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language C, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Mar 2023 17:54:00 +0000 (18:54 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 6 Mar 2023 17:54:00 +0000 (18:54 +0100)
commita6636c9a310a50cef71710008a7ff4bd62fe2b31
tree9a84b79a3dcc389626886e1868910ce56b30a58e
parent5cb3d9496eaae25e9298a76c21e59f8d122474d5
xgettext: In language C, avoid stack overflow.

* gettext-tools/src/x-c.c (MAX_NESTING_DEPTH): New macro.
(nesting_depth): New variable.
(extract_parenthesized): Increase and check nesting_depth before calling
extract_parenthesized recursively.
(extract_whole_file): Initialize nesting_depth.
* gettext-tools/tests/xgettext-c-stackovfl-1: New file.
* gettext-tools/tests/xgettext-c-stackovfl-2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-c.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-c-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-c-stackovfl-2 [new file with mode: 0755]