]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language Perl, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Thu, 9 Mar 2023 19:28:19 +0000 (20:28 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 9 Mar 2023 19:28:19 +0000 (20:28 +0100)
commit389824006bdcbbe1eab91ff2c953ea958296d0cd
treef206d7ddc8e656bde438b36dedaba4da3e500044
parent30122f64584480d73b84c0e62459a2ac16136796
xgettext: In language Perl, avoid stack overflow.

* gettext-tools/src/x-perl.c (MAX_NESTING_DEPTH): New macro.
(nesting_depth): New variable.
(interpolate_keywords): Increase and check nesting_depth. Revert it before
returning.
(x_perl_lex): Likewise.
(extract_balanced): Increase and check nesting_depth before calling
extract_balanced recursively.
(extract_perl): Initialize nesting_depth.
* gettext-tools/tests/xgettext-perl-stackovfl-1: New file.
* gettext-tools/tests/xgettext-perl-stackovfl-2: New file.
* gettext-tools/tests/xgettext-perl-stackovfl-3: New file.
* gettext-tools/tests/xgettext-perl-stackovfl-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-perl.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-perl-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-perl-stackovfl-2 [new file with mode: 0755]
gettext-tools/tests/xgettext-perl-stackovfl-3 [new file with mode: 0755]
gettext-tools/tests/xgettext-perl-stackovfl-4 [new file with mode: 0755]