]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tests: Add test for integer overflow when reading MO file
authorDaiki Ueno <ueno@gnu.org>
Tue, 18 Nov 2014 03:29:32 +0000 (12:29 +0900)
committerDaiki Ueno <ueno@gnu.org>
Sun, 23 Nov 2014 02:05:52 +0000 (11:05 +0900)
* msgunfmt-3: New file.
* Makefile.am (TESTS): Add new test.
(EXTRA_DIST): Add data file for msgunfmt-3.

gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/msgunfmt-3 [new file with mode: 0755]
gettext-tools/tests/overflow.mo [new file with mode: 0644]

index d6d6788b72b94557787d130b6cb439340bda5b49..cde48195fe8f6325d27e1a8e14f10ddb500a0b5e 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-18  Daiki Ueno  <ueno@gnu.org>
+
+       tests: Add test for integer overflow when reading MO file
+       * msgunfmt-3: New file.
+       * Makefile.am (TESTS): Add new test.
+       (EXTRA_DIST): Add data file for msgunfmt-3.
+
 2014-10-28  Daiki Ueno  <ueno@gnu.org>
 
        xgettext: Allow plural extraction from a single argument function
index 3df6e1f7ebe750f0d30af1db20a6e64ff0d87e20..910dde0a664fda2730b63afb158d55124869eb68 100644 (file)
@@ -63,7 +63,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
        msgmerge-properties-1 msgmerge-properties-2 \
        msgmerge-update-1 msgmerge-update-2 msgmerge-update-3 \
        msgmerge-update-4 \
-       msgunfmt-1 msgunfmt-2 \
+       msgunfmt-1 msgunfmt-2 msgunfmt-3 \
        msgunfmt-csharp-1 \
        msgunfmt-java-1 \
        msgunfmt-properties-1 \
@@ -145,7 +145,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
        autopoint-1 autopoint-2 autopoint-3
 
 EXTRA_DIST += init.sh init.cfg $(TESTS) \
-       test.mo xg-c-1.ok.po mex-test2.ok \
+       test.mo overflow.mo xg-c-1.ok.po mex-test2.ok \
        mm-ko.ascii.pot mm-ko.euc-kr.po mm-ko-comp.euc-kr.po \
        mm-viet.comp.po mm-viet.pot mm-viet.out \
        msguniq-a.in msguniq-a.inp msguniq-a.out \
diff --git a/gettext-tools/tests/msgunfmt-3 b/gettext-tools/tests/msgunfmt-3
new file mode 100755 (executable)
index 0000000..a1b98d7
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test invalid or incomplete input
+
+: ${MSGUNFMT=msgunfmt}
+LANGUAGE= LC_ALL=C ${MSGUNFMT} ../overflow.mo 2>mu-3.err >/dev/null
+test $? != 0 || exit 1
+grep ' is truncated' mu-3.err >/dev/null || exit 1
diff --git a/gettext-tools/tests/overflow.mo b/gettext-tools/tests/overflow.mo
new file mode 100644 (file)
index 0000000..3cb4e94
Binary files /dev/null and b/gettext-tools/tests/overflow.mo differ