]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: Perl: Avoid unbounded nesting_depth growth, part 2.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Sep 2023 17:02:01 +0000 (19:02 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 18 Sep 2023 18:07:27 +0000 (20:07 +0200)
commit578b1115fcfb6d069218d64c8ff900d3d109bfd9
tree0c435925f90be6e37109aebcadece1ea065222e7
parent3fda664058db0260956d2f47f896641549100b8b
xgettext: Perl: Avoid unbounded nesting_depth growth, part 2.

* gettext-tools/src/x-perl.c: Return from extract_balanced when a subroutine's
definition terminates.
(extract_balanced): Test whether the first token is 'sub'. If so, don't use
the usual symbol parsing and return when a token_type_lbrace was seen.

Test cases:
==========================================
sub import {
}
==========================================
sub import {
  if (!$module_loaded) {
    Texinfo::XSLoader::override("", "");
    Texinfo::XSLoader::override("", "");
    $module_loaded = 1;
  }
  goto &Exporter::import;
}
==========================================
gettext-tools/src/x-perl.c