summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* doc: Clarify when extracted comments get extracted.HEADmasterBruno Haible2023-05-031-5/+13
| | | | | | | | Fixes the fix from <https://savannah.gnu.org/bugs/index.php?42376>. Prompted by <https://savannah.gnu.org/bugs/index.php?64136>. * gettext-tools/doc/xgettext.texi: Clarify that it's not blank lines, but lines with tokens, that prevent the extraction of a preceding comment block.
* hostname: Use more modern network APIs.Bruno Haible2023-04-013-55/+178
| | | | | | | | | | | | | Reported by Jens Petersen <petersen@redhat.com> at <https://savannah.gnu.org/bugs/?63983>. * autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add getaddrinfo. * gettext-tools/src/hostname.c (HAVE_GETADDRINFO): Define to 1. Do the #includes for gethostname() after those for getaddrinfo(). (ipv4_is_linklocal, ipv6_is_linklocal): New functions. (print_hostname): For long_format and ip_format, prefer getaddrinfo over gethostbyname. * gettext-tools/src/Makefile.am (hostname_LDADD): New variable.
* Update to the newest gnulib.Bruno Haible2023-04-011-0/+0
|
* xgettext: In language Tcl, fix the \u, \U handling.Bruno Haible2023-04-011-0/+1
| | | | | * gettext-tools/src/x-tcl.c (do_getc_escaped_low_surrogate): Actually store the read characters in buf.
* Use string-desc module from gnulib.Bruno Haible2023-03-3014-508/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add string-desc. Remove memmem, memrchr. (GNULIB_MODULES_LIBGETTEXTPO): Likewise. * gettext-tools/src/str-desc.h: Remove file. * gettext-tools/src/str-desc.c: Remove file. * gettext-tools/src/FILES: Update. * gettext-tools/src/msgl-ascii.h: Include string-desc.h instead of str-desc.h. Use string_desc_t instead of string_desc_ty. * gettext-tools/src/msgl-ascii.c: Use string_desc_t instead of string_desc_ty. * gettext-tools/src/msgl-iconv.h: Include string-desc.h instead of str-desc.h. Use string_desc_t instead of string_desc_ty. * gettext-tools/src/msgl-iconv.c: Include string-desc.h instead of str-desc.h. Use string_desc_t instead of string_desc_ty. * gettext-tools/src/xg-encoding.h: Include string-desc.h instead of str-desc.h. Use string_desc_t instead of string_desc_ty. * gettext-tools/src/xg-encoding.c (string_desc_from_current_source_encoding): Use string_desc_t instead of string_desc_ty. * gettext-tools/src/x-perl.c: Include string-desc.h instead of str-desc.h. (extract_quotelike_pass1, extract_quotelike_pass1_utf8, extract_quotelike, extract_triple_quotelike, interpolate_keywords): Use string_desc_t instead of string_desc_ty. * gettext-tools/src/Makefile.am (noinst_HEADERS): Remove str-desc.h. (libgettextsrc_la_SOURCES): Remove str-desc.c. * gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Remove str-desc.c.
* Update to the newest gnulib.Bruno Haible2023-03-301-0/+0
|
* intl: Simplify use of vasnprintf from Gnulib.Bruno Haible2023-03-173-79/+2
| | | | | | | * autogen.sh (GNULIB_MODULES_LIBINTL): Use vasnprintf-posix instead of vasnprintf. * gettext-runtime/intl/vasnprintf.h: Remove file, moved to gnulib. * gettext-runtime/intl/Makefile.am (EXTRA_DIST): Remove vasnprintf.h. (printf.lo): Simplify dependencies accordingly.
* intl: Fix bug in the exported *wprintf functions.Bruno Haible2023-03-176-141/+42
| | | | | | | | | | | | | * autogen.sh (GNULIB_MODULES_LIBINTL): Add vasnwprintf-posix. * gettext-runtime/intl/configure.ac: Hide the symbols from the gnulib modules isnand-nolibm, isnanl-nolibm, printf-frexp, printf-frexpl, signbit, vasnwprintf, frexp-nolibm, frexpl-nolibm. * gettext-runtime/intl/printf.c: Don't instantiate the vasnwprintf code here. * gettext-runtime/intl/wprintf-parse.h: Remove file, moved to gnulib. * gettext-runtime/intl/vasnwprintf.h: Remove file, moved to gnulib. * gettext-runtime/intl/Makefile.am (EXTRA_DIST): Remove wprintf-parse.h, vasnwprintf.h. (printf.lo): Simplify dependencies accordingly.
* Update to the newest gnulib.Bruno Haible2023-03-171-0/+0
|
* build: Fix link error on native Windows (regression 2023-03-15).Bruno Haible2023-03-171-0/+4
| | | | | * autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC, GNULIB_MODULES_LIBGETTEXTPO): Add memmem and memrchr, needed by str-desc.c.
* doc: Add a clarification.Bruno Haible2023-03-161-1/+3
| | | | | | | | Reported by Christian Ohm <chr.ohm@gmx.net> in <https://savannah.gnu.org/bugs/?36084>. * gettext-tools/doc/gettext.texi (c-format Flag): Clarify that an xgettext:... comment applies only to the next string.
* xgettext: In language Perl, avoid a crash.Bruno Haible2023-03-153-3/+29
| | | | | | | * gettext-tools/src/xg-arglist-parser.c (arglist_parser_clone): Clone the msgid_pos correctly. * gettext-tools/tests/xgettext-perl-10: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language Perl, avoid a crash when NUL is used as delimiter.Bruno Haible2023-03-1514-66/+729
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gettext-tools/src/str-desc.h: New file. * gettext-tools/src/str-desc.c: New file. * gettext-tools/src/FILES: Describe them. * gettext-tools/src/Makefile.am (noinst_HEADERS): Add str-desc.h. (libgettextsrc_la_SOURCES): Add str-desc.c. * gettext-tools/src/msgl-ascii.h: Include str-desc.h. (is_ascii_string_desc): New declaration. * gettext-tools/src/msgl-ascii.c (is_ascii_string_desc): New function. * gettext-tools/src/msgl-iconv.h: Include str-desc.h. (convert_string_desc_directly): New declaration. * gettext-tools/src/msgl-iconv.c: Include str-desc.h. (convert_string_desc_directly): New function. * gettext-tools/src/xg-encoding.h: Include str-desc.h. (string_desc_from_current_source_encoding): New declaration. * gettext-tools/src/xg-encoding.c (string_desc_from_current_source_encoding): New function. * gettext-tools/src/x-perl.c: Include str-desc.h, c-ctype.h. (extract_quotelike_pass1): Return a string_desc_ty instead of a 'char *'. (extract_quotelike_pass1_utf8): Likewise. (extract_quotelike, extract_triple_quotelike): Update. (interpolate_keywords): Take a string_desc_ty instead of a 'const char *' as argument. (x_perl_prelex): Update. * gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Add str-desc.c. * gettext-tools/tests/xgettext-perl-9: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* po: In the Makefiles, enable --quiet by default when possible.Bruno Haible2023-03-1434-289/+347
| | | | | | | | | | | | | | | | | | | | | | | | | This is possible because msgmerge became faster - through an index-based fuzzy search (msgl-fsearch.c) in 2006, - through OpenMP parallelization in 2006, - through processor speedups over the years. The only case where msgmerge is still slow is when a compendium is in use. Suggested by Marcus Müller <marcus_savannah@hostalia.de> in <https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00034.html>. * gettext-runtime/po/Makefile.in.in ($(POFILES), update-po): If msgmerge has version ≥ 0.11, pass option --quiet. * gettext-runtime/po/Makevars (MSGMERGE_OPTIONS): Don't suggest --quiet any more. * gettext-tools/po/Makevars (MSGMERGE_OPTIONS): Likewise. * gettext-tools/examples/hello-*/po/Makevars (MSGMERGE_OPTIONS): Likewise. * gettext-tools/examples/hello-*/po/Makefile.am ($(POFILES), update-po): If msgmerge has version ≥ 0.11, pass option --quiet. (MSGMERGE_OPTIONS): Don't suggest --quiet any more. * gettext-tools/examples/hello-objc-gnustep/po/GNUmakefile: Likewise. * gettext-tools/examples/po/Makefile.am ($(POFILES), update-po): Pass option --quiet to msgmerge. (MSGMERGE_OPTIONS): Don't suggest --quiet any more.
* xgettext: In language Tcl, support \x, \u, \U escapes as specified in Tcl 8.6.Bruno Haible2023-03-144-30/+189
| | | | | | | | | | | | | | * gettext-tools/src/x-tcl.c: Update comments. (phase1_pushback): Increase size to 5. (do_getc_escaped): For \x, parse only up to 2 hexadecimal characters. Handle '\U'. (do_getc_escaped_low_surrogate): New function. (accumulate_word): After reading a high surrogate, see if it is followed by a low surrogate. * gettext-tools/tests/xgettext-tcl-4: Change expected outcome for \x. Add test cases for \u with surrogates and for \U. * gettext-tools/tests/xgettext-tcl-5: Add more test cases. * NEWS: Mention the change.
* xgettext: In language Tcl, avoid a crash at surrogate character escapes.Bruno Haible2023-03-143-7/+44
| | | | | | | * gettext-tools/src/x-tcl.c (accumulate_word): Warn when seeing a surrogate character, instead of aborting. * gettext-tools/tests/xgettext-tcl-5: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language Shell, avoid a crash.Bruno Haible2023-03-143-2/+25
| | | | | | * gettext-tools/src/x-sh.c (phase1_pushback): Increase size by 1. * gettext-tools/tests/xgettext-sh-8: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* lisp-format, scheme-format: Fix a loop transformation.Bruno Haible2023-03-144-1/+27
| | | | | | | | * gettext-tools/src/format-lisp.c (rotate_loop): Assign the new list->repeated.count. * gettext-tools/src/format-scheme.c (rotate_loop): Likewise. * gettext-tools/tests/xgettext-lisp-6: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* lisp-format: Fix a crash in format string that contains "~@?" before "~V".Bruno Haible2023-03-143-1/+27
| | | | | | | * gettext-tools/src/format-lisp.c (nocheck_params): Don't call add_req_type_constraint if position < 0. * gettext-tools/tests/xgettext-lisp-5: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* lisp-format, scheme-format: Fix a memory overrun.Bruno Haible2023-03-145-4/+52
| | | | | | | | | * gettext-tools/src/format-lisp.c (make_repeated_list): Fix upper bound of a loop. * gettext-tools/src/format-scheme.c (make_repeated_list): Likewise. * gettext-tools/tests/xgettext-lisp-4: New file. * gettext-tools/tests/xgettext-scheme-6: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* lisp-format, scheme-format: Improve run-time checks.Bruno Haible2023-03-142-20/+36
| | | | | | | * gettext-tools/src/format-lisp.c (add_type_constraint, add_listtype_constraint): Always check the result. * gettext-tools/src/format-scheme.c (add_type_constraint, add_listtype_constraint): Likewise.
* Fix lisp-format, scheme-format: Add a loop normalization.Bruno Haible2023-03-144-2/+22
| | | | | | | * gettext-tools/src/format-lisp.c (normalize_outmost_list): Algorithmic fixes. * gettext-tools/src/format-scheme.c (normalize_outmost_list): Likewise. * gettext-tools/tests/format-lisp-2: Add another test. * gettext-tools/tests/format-scheme-2: Likewise.
* Fix lisp-format, scheme-format: Fix a memory corruption bug.Bruno Haible2023-03-145-7/+54
| | | | | | | | | * gettext-tools/src/format-lisp.c (make_repeated_list): Access the correct array. * gettext-tools/src/format-scheme.c (make_repeated_list): Likewise. * gettext-tools/tests/xgettext-lisp-3: New file. * gettext-tools/tests/xgettext-scheme-5: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language JavaScript, avoid a crash.Bruno Haible2023-03-143-3/+24
| | | | | | | | | This avoids a crash "Assertion `phase2_pushback_length + j < SIZEOF (phase2_pushback)' failed.". * gettext-tools/src/x-javascript.c (phase2_pushback): Increase size by 1. * gettext-tools/tests/xgettext-javascript-12: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language JavaScript, avoid a crash at an XML comment, CDATA, or PI.Bruno Haible2023-03-145-20/+118
| | | | | | | | | | * gettext-tools/src/x-javascript.c (phase5_scan_xml_markup): Return int instead of bool. (phase5_get): Ignore XML markup parsed by phase5_scan_xml_markup. * gettext-tools/tests/xgettext-javascript-9: New file. * gettext-tools/tests/xgettext-javascript-10: New file. * gettext-tools/tests/xgettext-javascript-11: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language JavaScript, avoid a crash for some non-ASCII input.Bruno Haible2023-03-143-1/+44
| | | | | | | * gettext-tools/src/xg-encoding.c (non_ascii_error_message, non_utf8_error_message): Handle all possible lexical_context_ty values. * gettext-tools/tests/xgettext-javascript-8: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language C#, avoid a crash due to a too small buffer.Bruno Haible2023-03-143-2/+15
| | | | | | * gettext-tools/src/x-csharp.c (phase3_pushback): Increase size to 10. * gettext-tools/tests/xgettext-csharp-9: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* Fix python-brace-format: Fix placement of FMTDIR_ERROR marker.Bruno Haible2023-03-142-21/+24
| | | | | | * gettext-tools/src/format-python-brace.c (parse_directive): Simplify. Fix placement of FMTDIR_ERROR marker and improve error message in one case. * gettext-tools/tests/format-python-brace-1: Add more test cases.
* Fix python-brace-format: Disallow empty precision.Bruno Haible2023-03-142-2/+18
| | | | | | * gettext-tools/src/format-python-brace.c (parse_directive): After '.', expect at least one digit. * gettext-tools/tests/format-python-brace-1: Add a test case.
* xgettext: Avoid a crash due to a python-brace-format string with a NUL byte.Bruno Haible2023-03-143-13/+64
| | | | | | | * gettext-tools/src/format-python-brace.c: Improve comments. (parse_directive): Don't read past the string end if c1 is NUL. * gettext-tools/tests/xgettext-python-6: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: Fix abort when outputting a msgid that has an invalid UTF-8 character.Bruno Haible2023-03-1410-9/+206
| | | | | | | | | | | | | | | | * gettext-tools/src/xg-encoding.c: Include unistr.h. (non_utf8_error_message): New function. (from_current_source_encoding): When xgettext_current_source_encoding is "UTF-8", check that the string is well-formed UTF-8. * gettext-tools/tests/xgettext-c-8: New file. * gettext-tools/tests/xgettext-python-5: New file. * gettext-tools/tests/xgettext-elisp-3: New file. * gettext-tools/tests/xgettext-librep-3: New file. * gettext-tools/tests/xgettext-awk-3: New file. * gettext-tools/tests/xgettext-lua-3: New file. * gettext-tools/tests/xgettext-vala-4: New file. * gettext-tools/tests/xgettext-php-5: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* Simplify code.Bruno Haible2023-03-141-5/+2
| | | | | * gettext-tools/src/format-python-brace.c (parse_upto): Remove redundant declaration.
* xgettext: In language Vala, report out-of-range hexadecimal escapes.Bruno Haible2023-03-143-40/+91
| | | | | | | | | | This avoids a later crash "Assertion `UNICODE_VALUE (c) >= 0 && UNICODE_VALUE (c) < 0x110000' failed." * gettext-tools/src/x-vala.c (phase7_getc): When the value of a hexadecimal escape sequence overflows, warn and use the last value before it overflowed. * gettext-tools/tests/xgettext-vala-7: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language C, report out-of-range hexadecimal escapes.Bruno Haible2023-03-143-40/+92
| | | | | | | | | | This avoids a later crash "Assertion `UNICODE_VALUE (c) >= 0 && UNICODE_VALUE (c) < 0x110000' failed." * gettext-tools/src/x-c.c (phase7_getc): When the value of a hexadecimal escape sequence overflows, warn and use the last value before it overflowed. * gettext-tools/tests/xgettext-c-7: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it.
* xgettext: In language PO, handle non-ASCII non-UTF-8 input files correctly.Bruno Haible2023-03-147-4/+88
| | | | | | | | | | | | * gettext-tools/src/x-po.c: Include msgl-iconv.h, msgl-ascii.h, po-charset.h. (extract): If a header charset is present, convert the messages to UTF-8; otherwise verify that they are all ASCII. * gettext-tools/tests/xgettext-po-3: New file. * gettext-tools/tests/xgettext-po-4: New file. * gettext-tools/tests/testdata/xg-po-3.po: New file. * gettext-tools/tests/testdata/xg-po-4.po: New file. * gettext-tools/tests/Makefile.am (TESTS, EXTRA_DIST): Add them. * NEWS: Mention the change.
* po-mode: Fix incompatibility with the forthcoming Emacs 29.Bruno Haible2023-03-102-3/+5
| | | | | | | | | Patch by Takesi Ayanokoji <ayanokoji.takesi@gmail.com>. * gettext-tools/emacs/po-mode.el (po-font-lock-keywords): Use font-lock-constant-face, introduced in Emacs 20.3, instead of the long-deprecated font-lock-reference-face. * NEWS: Mention it.
* xgettext: In language YCP, avoid stack overflow.Bruno Haible2023-03-096-1/+304
| | | | | | | | | | | | | | * gettext-tools/src/x-ycp.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (extract_parenthesized): Increase and check nesting_depth before calling extract_parenthesized recursively. (extract_ycp): Initialize nesting_depth. * gettext-tools/tests/xgettext-ycp-stackovfl-1: New file. * gettext-tools/tests/xgettext-ycp-stackovfl-2: New file. * gettext-tools/tests/xgettext-ycp-stackovfl-3: New file. * gettext-tools/tests/xgettext-ycp-stackovfl-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language PHP, avoid stack overflow.Bruno Haible2023-03-096-1/+276
| | | | | | | | | | | | | | * gettext-tools/src/x-php.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (paren_nesting_depth, bracket_nesting_depth): New variables. (extract_balanced): Increase and check paren_nesting_depth or bracket_nesting_depth before calling extract_balanced recursively. (extract_python): Initialize paren_nesting_depth and bracket_nesting_depth. * gettext-tools/tests/xgettext-php-stackovfl-1: New file. * gettext-tools/tests/xgettext-php-stackovfl-2: New file. * gettext-tools/tests/xgettext-php-stackovfl-3: New file. * gettext-tools/tests/xgettext-php-stackovfl-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Perl, avoid stack overflow.Bruno Haible2023-03-096-2/+288
| | | | | | | | | | | | | | | | * gettext-tools/src/x-perl.c (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (interpolate_keywords): Increase and check nesting_depth. Revert it before returning. (x_perl_lex): Likewise. (extract_balanced): Increase and check nesting_depth before calling extract_balanced recursively. (extract_perl): Initialize nesting_depth. * gettext-tools/tests/xgettext-perl-stackovfl-1: New file. * gettext-tools/tests/xgettext-perl-stackovfl-2: New file. * gettext-tools/tests/xgettext-perl-stackovfl-3: New file. * gettext-tools/tests/xgettext-perl-stackovfl-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Tcl, avoid stack overflow.Bruno Haible2023-03-096-1/+268
| | | | | | | | | | | | | | * gettext-tools/src/x-tcl.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (bracket_nesting_depth, brace_nesting_depth): New variables. (accumulate_word, read_word): Increase and check bracket_nesting_depth or brace_nesting_depth before calling read_command_list recursively. (extract_tcl): Initialize bracket_nesting_depth and brace_nesting_depth. * gettext-tools/tests/xgettext-tcl-stackovfl-1: New file. * gettext-tools/tests/xgettext-tcl-stackovfl-2: New file. * gettext-tools/tests/xgettext-tcl-stackovfl-3: New file. * gettext-tools/tests/xgettext-tcl-stackovfl-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Vala, avoid stack overflow.Bruno Haible2023-03-094-1/+136
| | | | | | | | | | | * gettext-tools/src/x-vala.c (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (extract_balanced): Increase and check nesting_depth before calling extract_balanced recursively. (extract_vala): Initialize nesting_depth. * gettext-tools/tests/xgettext-vala-stackovfl-1: New file. * gettext-tools/tests/xgettext-vala-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Lua, avoid stack overflow.Bruno Haible2023-03-096-1/+308
| | | | | | | | | | | | | | * gettext-tools/src/x-lua.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (paren_nesting_depth, bracket_nesting_depth): New variables. (extract_balanced): Increase and check paren_nesting_depth or bracket_nesting_depth before calling extract_balanced recursively. (extract_lua): Initialize paren_nesting_depth and bracket_nesting_depth. * gettext-tools/tests/xgettext-lua-stackovfl-1: New file. * gettext-tools/tests/xgettext-lua-stackovfl-2: New file. * gettext-tools/tests/xgettext-lua-stackovfl-3: New file. * gettext-tools/tests/xgettext-lua-stackovfl-4: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language awk, avoid stack overflow.Bruno Haible2023-03-094-1/+138
| | | | | | | | | | | * gettext-tools/src/x-awk.c (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (extract_parenthesized): Increase and check nesting_depth before calling extract_parenthesized recursively. (extract_awk): Initialize nesting_depth. * gettext-tools/tests/xgettext-awk-stackovfl-1: New file. * gettext-tools/tests/xgettext-awk-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Shell, avoid stack overflow.Bruno Haible2023-03-097-1/+4444
| | | | | | | | | | | | | | | * gettext-tools/src/x-sh.c (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (read_word): Increase nesting_depth before calling read_command_list recursively. (read_command_list): Check nesting_depth. (extract_sh): Initialize nesting_depth. * gettext-tools/tests/xgettext-shell-stackovfl-1: New file. * gettext-tools/tests/xgettext-shell-stackovfl-2: New file. * gettext-tools/tests/xgettext-shell-stackovfl-3: New file. * gettext-tools/tests/xgettext-shell-stackovfl-4: New file. * gettext-tools/tests/xgettext-shell-stackovfl-5: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language librep, avoid stack overflow.Bruno Haible2023-03-094-1/+148
| | | | | | | | | | | | * gettext-tools/src/x-librep.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (read_object): Increase nesting_depth before calling read_object recursively. Check nesting_depth. (extract_librep): Initialize nesting_depth. * gettext-tools/tests/xgettext-librep-stackovfl-1: New file. * gettext-tools/tests/xgettext-librep-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language EmacsLisp, avoid stack overflow, part 2.Bruno Haible2023-03-096-2/+46
| | | | | | | | | | | | * gettext-tools/src/x-elisp.c (escape_nesting_depth): New variable. (do_getc_escaped): Increase escape_nesting_depth before calling do_getc_escaped recursively. Check escape_nesting_depth. (extract_elisp): Initialize escape_nesting_depth. * gettext-tools/tests/xgettext-elisp-stackovfl-3: New file. * gettext-tools/tests/xgettext-elisp-stackovfl-4: New file. * gettext-tools/tests/testdata/xg-el-so-3.el: New file. * gettext-tools/tests/testdata/xg-el-so-4.el: New file. * gettext-tools/tests/Makefile.am (TESTS, EXTRA_DIST): Add them.
* xgettext: In language EmacsLisp, avoid stack overflow, part 1.Bruno Haible2023-03-094-1/+162
| | | | | | | | | | | | * gettext-tools/src/x-elisp.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (read_object): Increase nesting_depth before calling read_object recursively. Check nesting_depth. (extract_elisp): Initialize nesting_depth. * gettext-tools/tests/xgettext-elisp-stackovfl-1: New file. * gettext-tools/tests/xgettext-elisp-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Lisp, avoid stack overflow.Bruno Haible2023-03-094-1/+146
| | | | | | | | | | | | * gettext-tools/src/x-lisp.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (read_object): Increase nesting_depth before calling read_object recursively. Check nesting_depth. (extract_lisp): Initialize nesting_depth. * gettext-tools/tests/xgettext-lisp-stackovfl-1: New file. * gettext-tools/tests/xgettext-lisp-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language Scheme, avoid stack overflow.Bruno Haible2023-03-094-1/+150
| | | | | | | | | | | | * gettext-tools/src/x-scheme.c: Include error-progname.h. (MAX_NESTING_DEPTH): New macro. (nesting_depth): New variable. (read_object): Increase nesting_depth before calling read_object recursively. Check nesting_depth. (extract_scheme): Initialize nesting_depth. * gettext-tools/tests/xgettext-scheme-stackovfl-1: New file. * gettext-tools/tests/xgettext-scheme-stackovfl-2: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.
* xgettext: In language JavaScript, avoid stack overflow.Bruno Haible2023-03-0710-4/+652
| | | | | | | | | | | | | | | | | | | | * gettext-tools/src/x-javascript.c (MAX_NESTING_DEPTH): New macro. (paren_nesting_depth, bracket_nesting_depth, brace_nesting_depth, xml_element_nesting_depth): New variables. (extract_balanced): Increase and check paren_nesting_depth or bracket_nesting_depth or brace_nesting_depth or xml_element_nesting_depth before calling extract_balanced recursively. (extract_javascript): Initialize paren_nesting_depth, bracket_nesting_depth, brace_nesting_depth, xml_element_nesting_depth. * gettext-tools/tests/xgettext-javascript-stackovfl-1: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-2: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-3: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-4: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-5: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-6: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-7: New file. * gettext-tools/tests/xgettext-javascript-stackovfl-8: New file. * gettext-tools/tests/Makefile.am (TESTS): Add them.