]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: In language Perl, avoid a crash when NUL is used as delimiter.
authorBruno Haible <bruno@clisp.org>
Wed, 15 Mar 2023 20:57:56 +0000 (21:57 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 15 Mar 2023 22:25:33 +0000 (23:25 +0100)
commitb49d82c60787d5d8549b352bbb73757f7f27ff0a
tree99babe18926311aaf2e35f7e66d37a173d05c16d
parent093929b1d90a98bf0986ded8b629a9d232a85e2e
xgettext: In language Perl, avoid a crash when NUL is used as delimiter.

* 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.
14 files changed:
gettext-tools/libgettextpo/Makefile.am
gettext-tools/src/FILES
gettext-tools/src/Makefile.am
gettext-tools/src/msgl-ascii.c
gettext-tools/src/msgl-ascii.h
gettext-tools/src/msgl-iconv.c
gettext-tools/src/msgl-iconv.h
gettext-tools/src/str-desc.c [new file with mode: 0644]
gettext-tools/src/str-desc.h [new file with mode: 0644]
gettext-tools/src/x-perl.c
gettext-tools/src/xg-encoding.c
gettext-tools/src/xg-encoding.h
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-perl-9 [new file with mode: 0755]