]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: In language C#, avoid a crash due to a too small buffer.
authorBruno Haible <bruno@clisp.org>
Sun, 12 Mar 2023 12:33:30 +0000 (13:33 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 14 Mar 2023 01:57:28 +0000 (02:57 +0100)
* 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.

gettext-tools/src/x-csharp.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-csharp-9 [new file with mode: 0755]

index 44cc774e32e41c826ead6b60b522d3ebd32b7b5a..1985c084fe61472312c2c8df5f05f725235f9243 100644 (file)
@@ -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
index cfbc7179ced7628869d021d240de8bfbe5c68223..b4bb3eba35f48dfa358bb9a2e798798f07ebe880 100644 (file)
@@ -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 (executable)
index 0000000..35fbaca
--- /dev/null
@@ -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