From: Bruno Haible Date: Mon, 18 Sep 2023 17:26:54 +0000 (+0200) Subject: xgettext: Perl: Avoid unbounded nesting_depth growth, part 3. X-Git-Tag: v0.23~382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3166398e57152d2c8fd23785463b2da9b96e145d;p=thirdparty%2Fgettext.git 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 { } ========================================== --- 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))) ;