From b42074149e34a730beac5126d27b4cb1c6996d47 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 18 Sep 2023 19:26:54 +0200 Subject: [PATCH] xgettext: Perl: Avoid unbounded nesting_depth growth, part 3. * gettext-tools/src/x-perl.c: Return from extract_balanced when a subroutine's definition terminates and that subroutine was defined after a declaration that ended with a semicolon. (extract_perl): Pass semicolon_delim=true. Test case: ========================================== my %a = 4; sub b { } ========================================== --- gettext-tools/src/x-perl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gettext-tools/src/x-perl.c b/gettext-tools/src/x-perl.c index 734ab3aaa..4ab0a66d8 100644 --- a/gettext-tools/src/x-perl.c +++ b/gettext-tools/src/x-perl.c @@ -3744,11 +3744,11 @@ extract_perl (FILE *f, const char *real_filename, const char *logical_filename, init_keywords (); - /* Eat tokens until eof is seen. When extract_balanced returns - due to an unbalanced closing brace, just restart it. */ + /* Eat tokens until eof is seen. When extract_balanced returns due to an + unbalanced closing brace or due to a semicolon, just restart it. */ while (!extract_balanced (mlp, token_type_rbrace, true, - false, false, false, + true, true, false, null_context, null_context_list_iterator, 1, arglist_parser_alloc (mlp, NULL))) ; -- 2.47.2