]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language C#, avoid stack overflow.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Mar 2023 21:21:03 +0000 (22:21 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 7 Mar 2023 15:59:35 +0000 (16:59 +0100)
commit5355816c16910fbaa41f1eb4e128114672aa7571
tree083fdefdc4c4e00d9b9a7bdfd442aded05359341
parentf56d235faf788162c09487df129996ae62f1121f
xgettext: In language C#, avoid stack overflow.

* gettext-tools/src/x-csharp.c (MAX_NESTING_DEPTH): New macro.
(paren_nesting_depth, brace_nesting_depth): New variables.
(extract_parenthesized): Increase and check paren_nesting_depth or
brace_nesting_depth before calling extract_parenthesized recursively.
(extract_csharp): Initialize paren_nesting_depth and brace_nesting_depth.
* gettext-tools/tests/xgettext-csharp-stackovfl-1: New file.
* gettext-tools/tests/xgettext-csharp-stackovfl-2: New file.
* gettext-tools/tests/xgettext-csharp-stackovfl-3: New file.
* gettext-tools/tests/xgettext-csharp-stackovfl-4: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add them.
gettext-tools/src/x-csharp.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-csharp-stackovfl-1 [new file with mode: 0755]
gettext-tools/tests/xgettext-csharp-stackovfl-2 [new file with mode: 0755]
gettext-tools/tests/xgettext-csharp-stackovfl-3 [new file with mode: 0755]
gettext-tools/tests/xgettext-csharp-stackovfl-4 [new file with mode: 0755]