aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrajagandev <dmoorefo@gmail.com>2016-02-08 07:53:08 -0800
committerSergey Poznyakoff <gray@gnu.org.ua>2016-11-10 12:53:30 +0200
commit01a4e056e6a581f015fed3eeaef012f8b951bd89 (patch)
treea0aa9f6ebac2176d8359e21343292fd13bd17155
parent7d55037f89ab630125c37e6fc571cf36bb0a94c3 (diff)
downloadcpio-01a4e056e6a581f015fed3eeaef012f8b951bd89.tar.gz
cpio-01a4e056e6a581f015fed3eeaef012f8b951bd89.tar.bz2
Add test for signed integer overflow
-rw-r--r--tests/big-block-size.at37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/big-block-size.at b/tests/big-block-size.at
new file mode 100644
index 0000000..380e025
--- /dev/null
+++ b/tests/big-block-size.at
@@ -0,0 +1,37 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Copyright (C) 2009-2010, 2014-2015 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([big block size])
+AT_KEYWORDS([block integer overflow])
+
+# Description: Cpio versions up to 2.12 did not check the size of the
+# value supplied to the --block-size argument. This could result in
+# a signed integer overflow.
+
+AT_CHECK([
+echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" > file
+echo file | cpio -o > a
+cpio -i --block-size=20971520 -F a
+],
+[2],
+[],
+[4 blocks
+cpio: invalid block size
+Try 'cpio --help' or 'cpio --usage' for more information.]
+)
+AT_CLEANUP
+
+

Return to:

Send suggestions and report system problems to the System administrator.