diff options
author | Bruno Haible <bruno@clisp.org> | 2023-03-12 13:33:30 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2023-03-14 02:57:28 +0100 |
commit | 7886dcc16749f40243243a27e1a1e94d176e793d (patch) | |
tree | 70b789d89ec68fc252b6487aa355e03c2fda1a7b | |
parent | 3396633eb956e024589147031956b4b0392b3ba0 (diff) | |
download | gettext-7886dcc16749f40243243a27e1a1e94d176e793d.tar.gz |
xgettext: In language C#, avoid a crash due to a too small buffer.
* 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.
-rw-r--r-- | gettext-tools/src/x-csharp.c | 2 | ||||
-rw-r--r-- | gettext-tools/tests/Makefile.am | 2 | ||||
-rwxr-xr-x | gettext-tools/tests/xgettext-csharp-9 | 13 |
3 files changed, 15 insertions, 2 deletions
diff --git a/gettext-tools/src/x-csharp.c b/gettext-tools/src/x-csharp.c index 44cc774e3..1985c084f 100644 --- a/gettext-tools/src/x-csharp.c +++ b/gettext-tools/src/x-csharp.c @@ -445,7 +445,7 @@ phase2_ungetc (int c) /* Line number defined in terms of phase3. */ static int logical_line_number; -static int phase3_pushback[9]; +static int phase3_pushback[10]; static int phase3_pushback_length; /* Read the next Unicode UCS-4 character from the input file, mapping diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index cfbc7179c..b4bb3eba3 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -96,7 +96,7 @@ TESTS = gettext-1 gettext-2 \ xgettext-c-stackovfl-1 xgettext-c-stackovfl-2 \ xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \ xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \ - xgettext-csharp-7 xgettext-csharp-8 \ + xgettext-csharp-7 xgettext-csharp-8 xgettext-csharp-9 \ xgettext-csharp-stackovfl-1 xgettext-csharp-stackovfl-2 \ xgettext-csharp-stackovfl-3 xgettext-csharp-stackovfl-4 \ xgettext-desktop-1 xgettext-desktop-2 \ diff --git a/gettext-tools/tests/xgettext-csharp-9 b/gettext-tools/tests/xgettext-csharp-9 new file mode 100755 index 000000000..35fbaca0f --- /dev/null +++ b/gettext-tools/tests/xgettext-csharp-9 @@ -0,0 +1,13 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test C# support: large pushback. + +cat <<\EOF > xg-cs-9.cs +x\U00000000 +EOF + +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location -d xg-cs-9.tmp xg-cs-9.cs || Exit 1 + +exit 0 |