]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Perl: Avoid unbounded nesting_depth growth, part 3.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Sep 2023 17:26:54 +0000 (19:26 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 19 Sep 2023 02:11:33 +0000 (04:11 +0200)
* 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

index 734ab3aaab7854920a79d53a563684ae048d27c9..4ab0a66d8f966f0f1e7dfd86041fbad0c6b79a6f 100644 (file)
@@ -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)))
     ;