]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language Shell, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Wed, 8 Mar 2023 18:36:35 +0000 (19:36 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 9 Mar 2023 10:40:25 +0000 (11:40 +0100)
commitbcd08ef4de638f94b511d8365cc178e7180188a9
treef10baf2fcfe3b62567b4655531337f2bc18e9aec
parent793f539ef3201392ae5e7649f369f97285fbbfe4
xgettext: In language Shell, avoid stack overflow.

* gettext-tools/src/x-sh.c (MAX_NESTING_DEPTH): New macro.
(nesting_depth): New variable.
(read_word): Increase nesting_depth before calling read_command_list
recursively.
(read_command_list): Check nesting_depth.
(extract_sh): Initialize nesting_depth.
* gettext-tools/tests/xgettext-shell-stackovfl-1: New file.
* gettext-tools/tests/xgettext-shell-stackovfl-2: New file.
* gettext-tools/tests/xgettext-shell-stackovfl-3: New file.
* gettext-tools/tests/xgettext-shell-stackovfl-4: New file.
* gettext-tools/tests/xgettext-shell-stackovfl-5: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-sh.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-sh-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-sh-stackovfl-2 [new file with mode: 0755]
gettext-tools/tests/xgettext-sh-stackovfl-3 [new file with mode: 0755]
gettext-tools/tests/xgettext-sh-stackovfl-4 [new file with mode: 0755]
gettext-tools/tests/xgettext-sh-stackovfl-5 [new file with mode: 0755]