import unittest
import subprocess
import logging
+import inspect
import os
import collections
+import urllib
import shutil
import random
import re
logg.debug("ERR: %s", line)
return Shell(run.returncode, output, errors, sh_command)
+def get_caller_name():
+ frame = inspect.currentframe().f_back.f_back
+ return frame.f_code.co_name
+def get_caller_caller_name():
+ frame = inspect.currentframe().f_back.f_back.f_back
+ return frame.f_code.co_name
+
def testdir(testname):
newdir = "tests/tmp."+testname
if os.path.isdir(newdir):
return newdir
def download(base_url, filename, into):
+ data = "tmp.download"
+ if not os.path.isdir(data):
+ os.makedirs(data)
+ subname = urllib.quote_plus(base_url)
+ subdir = os.path.join(data, subname)
+ if not os.path.isdir(subdir):
+ os.makedirs(subdir)
+ subfile = os.path.join(subdir, filename)
+ if not os.path.exists(subfile):
+ logg.info("need %s", subfile)
+ d = urllib.urlopen(base_url + "/" + filename)
+ f = open(subfile, "w")
+ f.write(d.read())
+ f.close()
+ #
if not os.path.isdir(into):
os.makedirs(into)
- if not os.path.exists(os.path.join(into, filename)):
- shell("cd {into} && wget {base_url}/{filename}".format(**locals()))
-def trycopy(srcdir, filename, into):
- if not os.path.isdir(into):
- os.makedirs(into)
- src_file = os.path.join(srcdir, filename)
- dst_file = os.path.join(into, filename)
- if os.path.isfile(src_file):
- shutil.copy(src_file, dst_file)
+ shutil.copy(subfile, into)
+ return filename
def output(cmd, shell=True):
run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE)
class ZZipTest(unittest.TestCase):
@property
def t(self):
- if not os.path.isdir(testdatadir):
- os.makedirs(testdatadir)
- return testdatdir
+ if not os.path.isdir(testdatadir):
+ os.makedirs(testdatadir)
+ return testdatdir
@property
def s(self):
return topsrcdir
def src(self, name):
return os.path.join(self.s, name)
def readme(self):
- f = open(self.src(readme))
- text = f.read()
- f.close()
- return text
+ f = open(self.src(readme))
+ text = f.read()
+ f.close()
+ return text
def mkfile(self, name, content):
b = os.path.dirname(name)
if not os.path.isdir(b):
- os.makedirs(b)
+ os.makedirs(b)
f = open(name, "w")
f.write(content)
f.close()
old1 = ''
old2 = ''
for i in xrange(size):
- while True:
- x = random.choice(" abcdefghijklmnopqrstuvwxyz\n")
- if x == old1 or x == old2: continue
- old1 = old2
- old2 = x
- break
- result.write(x)
+ while True:
+ x = random.choice(" abcdefghijklmnopqrstuvwxyz\n")
+ if x == old1 or x == old2: continue
+ old1 = old2
+ old2 = x
+ break
+ result.write(x)
return result.getvalue()
+ def caller_testname(self):
+ name = get_caller_caller_name()
+ x1 = name.find("_")
+ if x1 < 0: return name
+ x2 = name.find("_", x1+1)
+ if x2 < 0: return name
+ return name[:x2]
+ def testname(self, suffix = None):
+ name = self.caller_testname()
+ if suffix:
+ return name + "_" + suffix
+ return name
+ def testzip(self, testname = None):
+ testname = testname or self.caller_testname()
+ zipname = testname + ".zip"
+ return zipname
+ def testdir(self, testname = None):
+ testname = testname or self.caller_testname()
+ newdir = "tmp."+testname
+ if os.path.isdir(newdir):
+ shutil.rmtree(newdir)
+ os.makedirs(newdir)
+ return newdir
+ def rm_testdir(self, testname = None):
+ testname = testname or self.caller_testname()
+ newdir = "tmp."+testname
+ if os.path.isdir(newdir):
+ shutil.rmtree(newdir)
+ return newdir
+ def rm_testzip(self, testname = None):
+ testname = testname or self.caller_testname()
+ zipname = testname + ".zip"
+ if os.path.exists(zipname):
+ os.remove(zipname)
+ return True
################################################################
- def test_100_make_test0_zip(self):
+ def test_1000_make_test0_zip(self):
""" create a test.zip for later tests using standard 'zip'
It will fall back to a variant in the source code if 'zip'
is not installed on the build host. The content is just
self.mkfile(filename, filetext)
shell("{exe} ../{zipfile} README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 10)
- def test_101_make_test1_zip(self):
+ def test_10001_make_test1_zip(self):
""" create a test1.zip for later tests using standard 'zip'
It will fall back to a variant in the source code if 'zip'
is not installed on the build host. The archive has 10
self.mkfile(filename, filetext)
shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 10)
- def test_102_make_test2_zip(self):
+ def test_10002_make_test2_zip(self):
""" create a test2.zip for later tests using standard 'zip'
It will NOT fall back to a variant in the source code.
The archive has 100 generic files with known content. """
self.mkfile(filename, filetext)
shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 10)
- def test_103_make_test3_zip(self):
+ def test_10003_make_test3_zip(self):
""" create a test3.zip for later tests using standard 'zip'
It will NOT fall back to a variant in the source code.
The archive has 1000 generic files with known content. """
self.mkfile(filename, filetext)
shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 10)
- def test_104_make_test4_zip(self):
+ def test_10004_make_test4_zip(self):
""" create a test4.zip for later tests using standard 'zip'
It will NOT fall back to a variant in the source code.
The archive has 10000 generic files with known content
self.mkfile(filename, filetext)
shell("{exe} -n README ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 1000000)
- def test_105_make_test5_zip(self):
+ def test_10005_make_test5_zip(self):
""" create a test5.zip for later tests using standard 'zip'
It will NOT fall back to a variant in the source code.
The archive has files at multiple subdirectories depth
self.mkfile(filename, filetext)
shell("{exe} ../{zipfile} -r file* subdir* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 1000000)
- def test_110_make_test0_dat(self):
+ def test_10010_make_test0_dat(self):
""" create test.dat from test.zip with xorcopy """
zipfile = "test0.zip"
datfile = "test0x.dat"
shell("{exe} {zipfile} {datfile}".format(**locals()))
self.assertGreater(os.path.getsize(datfile), 10)
self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
- def test_111_make_test1_dat(self):
+ def test_10011_make_test1_dat(self):
""" create test.dat from test.zip with xorcopy """
zipfile = "test1.zip"
datfile = "test1x.dat"
shell("{exe} {zipfile} {datfile}".format(**locals()))
self.assertGreater(os.path.getsize(datfile), 10)
self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
- def test_112_make_test2_dat(self):
+ def test_10012_make_test2_dat(self):
""" create test.dat from test.zip with xorcopy """
zipfile = "test2.zip"
datfile = "test2x.dat"
shell("{exe} {zipfile} {datfile}".format(**locals()))
self.assertGreater(os.path.getsize(datfile), 10)
self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
- def test_113_make_test3_dat(self):
+ def test_10013_make_test3_dat(self):
""" create test.dat from test.zip with xorcopy """
zipfile = "test3.zip"
datfile = "test3x.dat"
shell("{exe} {zipfile} {datfile}".format(**locals()))
self.assertGreater(os.path.getsize(datfile), 10)
self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
- def test_114_make_test4_dat(self):
+ def test_10014_make_test4_dat(self):
""" create test.dat from test.zip with xorcopy """
zipfile = "test4.zip"
datfile = "test4x.dat"
shell("{exe} {zipfile} {datfile}".format(**locals()))
self.assertGreater(os.path.getsize(datfile), 10)
self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
- def test_200_zziptest_test0_zip(self):
+ def test_20000_zziptest_test0_zip(self):
""" run zziptest on test.zip """
zipfile = "test0.zip"
logfile = "test0.log"
exe = self.bins("zziptest")
shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
- def test_201_zziptest_test1_zip(self):
+ def test_20001_zziptest_test1_zip(self):
""" run zziptest on test.zip """
zipfile = "test1.zip"
logfile = "test1.log"
exe = self.bins("zziptest")
shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
- def test_202_zziptest_test2_zip(self):
+ def test_20002_zziptest_test2_zip(self):
""" run zziptest on test.zip """
zipfile = "test2.zip"
logfile = "test2.log"
exe = self.bins("zziptest")
shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
- def test_203_zziptest_test3_zip(self):
+ def test_20003_zziptest_test3_zip(self):
""" run zziptest on test.zip """
zipfile = "test3.zip"
logfile = "test3.log"
exe = self.bins("zziptest")
shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
- def test_204_zziptest_test4_zip(self):
+ def test_20004_zziptest_test4_zip(self):
""" run zziptest on test.zip """
zipfile = "test4.zip"
logfile = "test4.log"
exe = self.bins("zziptest")
shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
- def test_210_zzcat_test0_zip(self):
+ def test_20010_zzcat_test0_zip(self):
""" run zzcat on test.zip using just test/README """
zipfile = "test0.zip"
getfile = "test0/README"
run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_211_zzcat_test1_zip(self):
+ def test_20011_zzcat_test1_zip(self):
""" run zzcat on test.zip using just test/README """
zipfile = "test1.zip"
getfile = "test1/README"
getfile = "test1/file.1"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_212_zzcat_test2_zip(self):
+ def test_20012_zzcat_test2_zip(self):
""" run zzcat on test.zip using just test/README """
zipfile = "test2.zip"
getfile = "test2/README"
getfile = "test2/file.22"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_213_zzcat_test3_zip(self):
+ def test_20013_zzcat_test3_zip(self):
""" run zzcat on test.zip using just test/README """
zipfile = "test3.zip"
getfile = "test3/README"
getfile = "test3/file.999"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-999\n", run.output)
- def test_214_zzcat_test4_zip(self):
+ def test_20014_zzcat_test4_zip(self):
""" run zzcat on test.zip using just test/README """
zipfile = "test4.zip"
getfile = "test4/README"
getfile = "test4/file9999.txt"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-9999\n", run.output)
- def test_220_zzdir_test0_zip(self):
+ def test_20020_zzdir_test0_zip(self):
""" run zzdir on test0.zip using just 'test0' """
zipfile = "test0.zip"
getfile = "test0"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertLess(len(run.output), 30)
- def test_221_zzdir_test1_zip(self):
+ def test_20021_zzdir_test1_zip(self):
""" run zzdir on test1.zip using just 'test1' """
zipfile = "test1.zip"
getfile = "test1"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_222_zzdir_test2_zip(self):
+ def test_20022_zzdir_test2_zip(self):
""" run zzdir on test2.zip using just 'test2' """
zipfile = "test2.zip"
getfile = "test2"
self.assertIn(' file.99\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_223_zzdir_test3_zip(self):
+ def test_20023_zzdir_test3_zip(self):
""" run zzdir on test3.zip using just 'test3' """
zipfile = "test3.zip"
getfile = "test3"
self.assertIn(' file.999\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_224_zzdir_test4_zip(self):
+ def test_20024_zzdir_test4_zip(self):
""" run zzdir on test4.zip using just 'test4' """
zipfile = "test4.zip"
getfile = "test4"
self.assertIn(' file9999.txt\n', run.output)
self.assertNotIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_320_zzxordir_test0_dat(self):
+ def test_20320_zzxordir_test0_dat(self):
""" run zzxordir on test0x.dat """
zipfile = "test0x.dat"
getfile = "test0x.dat"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertLess(len(run.output), 30)
- def test_321_zzxordir_test1_dat(self):
+ def test_20321_zzxordir_test1_dat(self):
""" run zzxordir on test1x.dat using just 'test1x' """
zipfile = "test1x.dat"
getfile = "test1x.dat"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_322_zzxordir_test2_dat(self):
+ def test_20322_zzxordir_test2_dat(self):
""" run zzxordir on test2x.dat using just 'test2x' """
zipfile = "test2x.dat"
getfile = "test2x"
self.assertIn(' file.99\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_323_zzxordir_test3_dat(self):
+ def test_20323_zzxordir_test3_dat(self):
""" run zzxordir on test3x.dat using just 'test3x' """
zipfile = "test3x.dat"
getfile = "test3x"
self.assertIn(' file.999\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_324_zzxordir_test4_zip(self):
+ def test_20324_zzxordir_test4_zip(self):
""" run zzxordir on test4x.dat using just 'test4x' """
zipfile = "test4x.dat"
getfile = "test4x"
self.assertIn(' file9999.txt\n', run.output)
self.assertNotIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_340_zzxorcat_test0_zip(self):
+ def test_20340_zzxorcat_test0_zip(self):
""" run zzxorcat on testx.zip using just testx/README """
getfile = "test0x/README"
logfile = "test0x.readme.txt"
run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_341_zzxorcat_test1_zip(self):
+ def test_20341_zzxorcat_test1_zip(self):
""" run zzxorcat on testx.zip using just testx/README """
getfile = "test1x/README"
logfile = "test1x.readme.txt"
getfile = "test1x/file.1"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_342_zzxorcat_test2_zip(self):
+ def test_20342_zzxorcat_test2_zip(self):
""" run zzxorcat on testx.zip using just testx/README """
getfile = "test2x/README"
logfile = "test2x.readme.txt"
getfile = "test2x/file.22"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_343_zzxorcat_test3_zip(self):
+ def test_20343_zzxorcat_test3_zip(self):
""" run zzxorcat on testx.zip using just testx/README """
getfile = "test3x/README"
logfile = "test3x.readme.txt"
getfile = "test3x/file.999"
run = shell("{exe} {getfile}".format(**locals()))
self.assertEqual("file-999\n", run.output)
- def test_344_zzxorcat_test4_zip(self):
+ def test_20344_zzxorcat_test4_zip(self):
""" run zzxorcat on testx.zip using just testx/README """
getfile = "test4x/README"
logfile = "test4x.readme.txt"
#####################################################################
# check unzzip
#####################################################################
- def test_400_infozip_cat_test0_zip(self):
+ def test_20400_infozip_cat_test0_zip(self):
""" run inzo-zip cat test.zip using just archive README """
zipfile = "test0.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_401_infozip_cat_test1_zip(self):
+ def test_20401_infozip_cat_test1_zip(self):
""" run info-zip cat test.zip using just archive README """
zipfile = "test1.zip"
getfile = "README"
getfile = "file.1"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_402_infozip_cat_test2_zip(self):
+ def test_20402_infozip_cat_test2_zip(self):
""" run info-zip cat test.zip using just archive README """
zipfile = "test2.zip"
getfile = "README"
getfile = "file.22"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_405_zzcat_big_test5_zip(self):
+ def test_20405_zzcat_big_test5_zip(self):
""" run info-zip cat test.zip using archive README """
zipfile = "test5.zip"
getfile = "README"
compare = self.gentext(1024)
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual(compare, run.output)
- def test_410_zzcat_big_test0_zip(self):
+ def test_20410_zzcat_big_test0_zip(self):
""" run zzcat-big on test.zip using just archive README """
zipfile = "test0.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_411_zzcat_big_test1_zip(self):
+ def test_20411_zzcat_big_test1_zip(self):
""" run zzcat-big on test.zip using just archive README """
zipfile = "test1.zip"
getfile = "README"
getfile = "file.1"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_412_zzcat_big_test2_zip(self):
+ def test_20412_zzcat_big_test2_zip(self):
""" run zzcat-seeke on test.zip using just archive README """
zipfile = "test2.zip"
getfile = "README"
getfile = "file.22"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_415_zzcat_big_test5_zip(self):
+ def test_20415_zzcat_big_test5_zip(self):
""" run zzcat-big on test.zip using archive README """
zipfile = "test5.zip"
getfile = "README"
compare = self.gentext(1024)
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual(compare, run.output)
- def test_420_zzcat_mem_test0_zip(self):
+ def test_20420_zzcat_mem_test0_zip(self):
""" run zzcat-mem on test.zip using just archive README """
zipfile = "test0.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_421_zzcat_mem_test1_zip(self):
+ def test_20421_zzcat_mem_test1_zip(self):
""" run zzcat-mem on test.zip using archive README """
zipfile = "test1.zip"
getfile = "README"
getfile = "file.1"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_422_zzcat_mem_test2_zip(self):
+ def test_20422_zzcat_mem_test2_zip(self):
""" run zzcat-mem on test.zip using archive README """
zipfile = "test2.zip"
getfile = "README"
getfile = "file.22"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_423_zzcat_mem_test3_zip(self):
+ def test_20423_zzcat_mem_test3_zip(self):
""" run zzcat-mem on test.zip using archive README """
zipfile = "test3.zip"
getfile = "README"
getfile = "file.999"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-999\n", run.output)
- def test_424_zzcat_mem_test4_zip(self):
+ def test_20424_zzcat_mem_test4_zip(self):
""" run zzcat-mem on test.zip using archive README """
zipfile = "test4.zip"
getfile = "README"
getfile = "file9999.txt"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-9999\n", run.output)
- def test_425_zzcat_mem_test5_zip(self):
+ def test_20425_zzcat_mem_test5_zip(self):
""" run zzcat-mem on test.zip using archive README """
zipfile = "test5.zip"
getfile = "README"
compare = self.gentext(1024)
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual(compare, run.output)
- def test_430_zzcat_mix_test0_zip(self):
+ def test_20430_zzcat_mix_test0_zip(self):
""" run zzcat-mix on test.zip using just archive README """
zipfile = "test0.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_431_zzcat_mix_test1_zip(self):
+ def test_20431_zzcat_mix_test1_zip(self):
""" run zzcat-mix on test.zip using archive README """
zipfile = "test1.zip"
getfile = "README"
getfile = "file.1"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_432_zzcat_mix_test2_zip(self):
+ def test_20432_zzcat_mix_test2_zip(self):
""" run zzcat-mix on test.zip using archive README """
zipfile = "test2.zip"
getfile = "README"
getfile = "file.22"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_433_zzcat_mix_test3_zip(self):
+ def test_20433_zzcat_mix_test3_zip(self):
""" run zzcat-mix on test.zip using archive README """
zipfile = "test3.zip"
getfile = "README"
getfile = "file.999"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-999\n", run.output)
- def test_434_zzcat_mix_test4_zip(self):
+ def test_20434_zzcat_mix_test4_zip(self):
""" run zzcat-mix on test.zip using archive README """
zipfile = "test4.zip"
getfile = "README"
getfile = "file9999.txt"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-9999\n", run.output)
- def test_435_zzcat_mix_test5_zip(self):
+ def test_20435_zzcat_mix_test5_zip(self):
""" run zzcat-mix on test.zip using archive README """
zipfile = "test5.zip"
getfile = "README"
compare = self.gentext(1024)
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual(compare, run.output)
- def test_440_zzcat_zap_test0_zip(self):
+ def test_20440_zzcat_zap_test0_zip(self):
""" run zzcat-zap on test.zip using just archive README """
zipfile = "test0.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertGreater(os.path.getsize(logfile), 10)
self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
- def test_441_zzcat_zap_test1_zip(self):
+ def test_20441_zzcat_zap_test1_zip(self):
""" run zzcat-zap on test.zip using archive README """
zipfile = "test1.zip"
getfile = "README"
getfile = "file.1"
run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
self.assertEqual("file-1\n", run.output)
- def test_442_zzcat_zap_test2_zip(self):
+ def test_20442_zzcat_zap_test2_zip(self):
""" run zzcat-zap on test.zip using archive README """
zipfile = "test2.zip"
getfile = "README"
getfile = "file.22"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-22\n", run.output)
- def test_443_zzcat_zap_test3_zip(self):
+ def test_20443_zzcat_zap_test3_zip(self):
""" run zzcat-zap on test.zip using archive README """
zipfile = "test3.zip"
getfile = "README"
getfile = "file.999"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-999\n", run.output)
- def test_444_zzcat_zap_test4_zip(self):
+ def test_20444_zzcat_zap_test4_zip(self):
""" run zzcat-zap on test.zip using archive README """
zipfile = "test4.zip"
getfile = "README"
getfile = "file9999.txt"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual("file-9999\n", run.output)
- def test_445_zzcat_zap_test5_zip(self):
+ def test_20445_zzcat_zap_test5_zip(self):
""" run zzcat-zap on test.zip using archive README """
zipfile = "test5.zip"
getfile = "README"
run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
self.assertEqual(compare, run.output)
- def test_500_infozipdir_test0_zip(self):
+ def test_20500_infozipdir_test0_zip(self):
""" run info-zip dir test0.zip """
zipfile = "test0.zip"
getfile = "test0.zip"
run = shell("{exe} -l {getfile} ".format(**locals()))
self.assertIn(' README\n', run.output)
self.assertLess(len(run.output), 230)
- def test_501_infozipdir_test1_zip(self):
+ def test_20501_infozipdir_test1_zip(self):
""" run info-zip dir test1.zip """
zipfile = "test1.zip"
getfile = "test1.zip"
self.assertIn(' file.2\n', run.output)
self.assertIn(' file.9\n', run.output)
self.assertIn(' README\n', run.output)
- def test_502_infozipdir_big_test2_zip(self):
+ def test_20502_infozipdir_big_test2_zip(self):
""" run info-zip dir test2.zip """
zipfile = "test2.zip"
getfile = "test2.zip"
self.assertIn(' file.01\n', run.output)
self.assertIn(' file.22\n', run.output)
self.assertIn(' file.99\n', run.output)
- def test_503_infozipdir_big_test3_zip(self):
+ def test_20503_infozipdir_big_test3_zip(self):
""" run info-zip dir test3.zip """
zipfile = "test3.zip"
getfile = "test3.zip"
self.assertIn(' file.001\n', run.output)
self.assertIn(' file.222\n', run.output)
self.assertIn(' file.999\n', run.output)
- def test_504_infozipdir_big_test4_zip(self):
+ def test_20504_infozipdir_big_test4_zip(self):
""" run info-zip dir test4.zip """
zipfile = "test4.zip"
getfile = "test4.zip"
self.assertIn(' file0001.txt\n', run.output)
self.assertIn(' file2222.txt\n', run.output)
self.assertIn(' file9999.txt\n', run.output)
- def test_505_infozipdir_big_test5_zip(self):
+ def test_20505_infozipdir_big_test5_zip(self):
""" run info-zip dir on test5.zip """
zipfile = "test5.zip"
getfile = "test5.zip"
self.assertIn('/subdir5/subdir6/', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_510_zzdir_big_test0_zip(self):
+ def test_20510_zzdir_big_test0_zip(self):
""" run zzdir-big on test0.zip """
zipfile = "test0.zip"
getfile = "test0.zip"
run = shell("{exe} -l {getfile} ".format(**locals()))
self.assertIn(' README\n', run.output)
self.assertLess(len(run.output), 30)
- def test_511_zzdir_big_test1_zip(self):
+ def test_20511_zzdir_big_test1_zip(self):
""" run zzdir-big on test1.zip """
zipfile = "test1.zip"
getfile = "test1.zip"
self.assertIn(' file.2\n', run.output)
self.assertIn(' file.9\n', run.output)
self.assertIn(' README\n', run.output)
- def test_512_zzdir_big_test2_zip(self):
+ def test_20512_zzdir_big_test2_zip(self):
""" run zzdir-big on test2.zip """
zipfile = "test2.zip"
getfile = "test2.zip"
self.assertIn(' file.01\n', run.output)
self.assertIn(' file.22\n', run.output)
self.assertIn(' file.99\n', run.output)
- def test_513_zzdir_big_test3_zip(self):
+ def test_20513_zzdir_big_test3_zip(self):
""" run zzdir-big on test3.zip """
zipfile = "test3.zip"
getfile = "test3.zip"
self.assertIn(' file.001\n', run.output)
self.assertIn(' file.222\n', run.output)
self.assertIn(' file.999\n', run.output)
- def test_514_zzdir_big_test4_zip(self):
+ def test_20514_zzdir_big_test4_zip(self):
""" run zzdir-big on test4.zip """
zipfile = "test4.zip"
getfile = "test4.zip"
self.assertIn(' file0001.txt\n', run.output)
self.assertIn(' file2222.txt\n', run.output)
self.assertIn(' file9999.txt\n', run.output)
- def test_515_zzdir_big_test5_zip(self):
+ def test_20515_zzdir_big_test5_zip(self):
""" run zzdir-big on test5.zip """
zipfile = "test5.zip"
getfile = "test5.zip"
self.assertIn('/subdir5/subdir6/', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_520_zzdir_mem_test0_zip(self):
+ def test_20520_zzdir_mem_test0_zip(self):
""" run zzdir-mem on test0.zip """
zipfile = "test0.zip"
getfile = "test0.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertLess(len(run.output), 30)
- def test_521_zzdir_mem_test1_zip(self):
+ def test_20521_zzdir_mem_test1_zip(self):
""" run zzdir-mem on test1.zip """
zipfile = "test1.zip"
getfile = "test1.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_522_zzdir_mem_test2_zip(self):
+ def test_20522_zzdir_mem_test2_zip(self):
""" run zzdir-mem on test2.zip """
zipfile = "test2.zip"
getfile = "test2.zip"
self.assertIn(' file.99\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_523_zzdir_mem_test3_zip(self):
+ def test_20523_zzdir_mem_test3_zip(self):
""" run zzdir-mem on test3.zip """
zipfile = "test3.zip"
getfile = "test3.zip"
self.assertIn(' file.999\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_524_zzdir_mem_test4_zip(self):
+ def test_20524_zzdir_mem_test4_zip(self):
""" run zzdir-mem on test4.zip """
zipfile = "test4.zip"
getfile = "test4.zip"
self.assertIn(' file9999.txt\n', run.output)
self.assertNotIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_525_zzdir_mem_test5_zip(self):
+ def test_20525_zzdir_mem_test5_zip(self):
""" run zzdir-mem on test5.zip """
zipfile = "test5.zip"
getfile = "test5.zip"
self.assertIn('/subdir5/subdir6/', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_530_zzdir_mix_test0_zip(self):
+ def test_20530_zzdir_mix_test0_zip(self):
""" run zzdir-mix on test0.zip """
# self.skipTest("todo")
zipfile = "test0.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertLess(len(run.output), 30)
- def test_531_zzdir_mix_test1_zip(self):
+ def test_20531_zzdir_mix_test1_zip(self):
""" run zzdir-mix on test1.zip """
zipfile = "test1.zip"
getfile = "test1.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_532_zzdir_mix_test2_zip(self):
+ def test_20532_zzdir_mix_test2_zip(self):
""" run zzdir-mix on test2.zip """
zipfile = "test2.zip"
getfile = "test2.zip"
self.assertIn(' file.99\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_533_zzdir_mix_test3_zip(self):
+ def test_20533_zzdir_mix_test3_zip(self):
""" run zzdir-mix on test3.zip """
zipfile = "test3.zip"
getfile = "test3.zip"
self.assertIn(' file.999\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_534_zzdir_mix_test4_zip(self):
+ def test_20534_zzdir_mix_test4_zip(self):
""" run zzdir-mix on test4.zip """
zipfile = "test4.zip"
getfile = "test4.zip"
self.assertIn(' file9999.txt\n', run.output)
self.assertNotIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_535_zzdir_mix_test5_zip(self):
+ def test_20535_zzdir_mix_test5_zip(self):
""" run zzdir-mix on test5.zip """
zipfile = "test5.zip"
getfile = "test5.zip"
self.assertIn('/subdir5/subdir6/', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_540_zzdir_zap_test0_zip(self):
+ def test_20540_zzdir_zap_test0_zip(self):
""" run zzdir-zap on test0.zip """
zipfile = "test0.zip"
getfile = "test0.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertLess(len(run.output), 30)
- def test_541_zzdir_zap_test1_zip(self):
+ def test_20541_zzdir_zap_test1_zip(self):
""" run zzdir-zap on test1.zip """
zipfile = "test1.zip"
getfile = "test1.zip"
self.assertIn(' README\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_542_zzdir_zap_test2_zip(self):
+ def test_20542_zzdir_zap_test2_zip(self):
""" run zzdir-zap on test2.zip """
zipfile = "test2.zip"
getfile = "test2.zip"
self.assertIn(' file.99\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_543_zzdir_zap_test3_zip(self):
+ def test_20543_zzdir_zap_test3_zip(self):
""" run zzdir-zap on test3.zip """
zipfile = "test3.zip"
getfile = "test3.zip"
self.assertIn(' file.999\n', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_544_zzdir_zap_test4_zip(self):
+ def test_20544_zzdir_zap_test4_zip(self):
""" run zzdir-zap on test4.zip """
zipfile = "test4.zip"
getfile = "test4.zip"
self.assertIn(' file9999.txt\n', run.output)
self.assertNotIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_545_zzdir_zap_test5_zip(self):
+ def test_20545_zzdir_zap_test5_zip(self):
""" run zzdir-zap on test5.zip """
zipfile = "test5.zip"
getfile = "test5.zip"
self.assertIn('/subdir5/subdir6/', run.output)
self.assertIn(' defl:N ', run.output)
self.assertIn(' stored ', run.output)
- def test_595_zzextract_zap_test5_zip(self):
+ def test_20595_zzextract_zap_test5_zip(self):
""" run zzextract-zap on test5.zip
=> coughs up a SEGFAULT in zzip_dir_close() ?!?"""
zipfile = "test5.zip"
getfile = "test5.zip"
- tmpdir = "tmp.test_595"
- testdir(tmpdir)
+ tmpdir = self.testdir()
exe = self.bins("unzzip")
run = shell("cd {tmpdir} && ../{exe} ../{getfile} ".format(**locals()))
self.assertTrue(tmpdir+'/subdir1/subdir2/file3-1024.txt')
url_CVE_2017_5977 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5977 = "00153-zziplib-invalidread-zzip_mem_entry_extra_block"
- def test_600_infozipdir_CVE_2017_5977(self):
+ def test_59770_infozipdir_CVE_2017_5977(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_600"
+ tmpdir = "tmp.test_59770"
filename = self.zip_CVE_2017_5977
file_url = self.url_CVE_2017_5977
- trycopy("tmp.test_601", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(" didn't find end-of-central-dir signature at end of central dir", run.errors)
self.assertIn(" 2 extra bytes at beginning or within zipfile", run.errors)
self.assertLess(len(run.output), 280)
- def test_601_zzipdir_big_CVE_2017_5977(self):
+ def test_59771_zzipdir_big_CVE_2017_5977(self):
""" run info-zip -l $(CVE_2017_5977).zip """
- tmpdir = "tmp.test_601"
+ tmpdir = "tmp.test_59771"
filename = self.zip_CVE_2017_5977
file_url = self.url_CVE_2017_5977
testdir(tmpdir)
- trycopy("tmp.test_600", filename, tmpdir)
- trycopy("tmp.test_602", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored test", run.output)
- def test_602_zzipdir_mem_CVE_2017_5977(self):
+ def test_59772_zzipdir_mem_CVE_2017_5977(self):
""" run unzzip-mem -l $(CVE_2017_5977).zip """
- tmpdir = "tmp.test_602"
+ tmpdir = "tmp.test_59772"
filename = self.zip_CVE_2017_5977
file_url = self.url_CVE_2017_5977
testdir(tmpdir)
- trycopy("tmp.test_601", filename, tmpdir)
- trycopy("tmp.test_603", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
- def test_603_zzipdir_mem_CVE_2017_5977(self):
- """ run unzzip-mem -l $(CVE_2017_5977).zip """
- tmpdir = "tmp.test_603"
+ def test_59773_zzipdir_mix_CVE_2017_5977(self):
+ """ run unzzip-mix -l $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59773"
filename = self.zip_CVE_2017_5977
file_url = self.url_CVE_2017_5977
testdir(tmpdir)
- trycopy("tmp.test_602", filename, tmpdir)
- trycopy("tmp.test_604", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
- def test_604_zzipdir_zap_CVE_2017_5977(self):
- """ run unzzip-mix -l $(CVE_2017_5977).zip """
- tmpdir = "tmp.test_604"
+ def test_59774_zzipdir_zap_CVE_2017_5977(self):
+ """ run unzzip -l $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59774"
filename = self.zip_CVE_2017_5977
file_url = self.url_CVE_2017_5977
testdir(tmpdir)
- trycopy("tmp.test_603", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
+ def test_59775_zipext_info_CVE_2017_5977(self):
+ """ run info' unzip $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59775"
+ filename = self.zip_CVE_2017_5977
+ file_url = self.url_CVE_2017_5977
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [2])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 900)
+ self.assertIn('test: mismatching "local" filename', run.errors)
+ self.assertIn('test: unknown compression method', run.errors)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ def test_59776_zzipext_big_CVE_2017_5977(self):
+ """ run unzzip-big $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59776"
+ filename = self.zip_CVE_2017_5977
+ file_url = self.url_CVE_2017_5977
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ @unittest.expectedFailure
+ def test_59777_zzipext_mem_CVE_2017_5977(self):
+ """ run unzzip-mem $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59777"
+ filename = self.zip_CVE_2017_5977
+ file_url = self.url_CVE_2017_5977
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ def test_59778_zzipext_mix_CVE_2017_5977(self):
+ """ run unzzip-mix $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59778"
+ filename = self.zip_CVE_2017_5977
+ file_url = self.url_CVE_2017_5977
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ def test_59779_zzipext_zap_CVE_2017_5977(self):
+ """ run unzzip $(CVE_2017_5977).zip """
+ tmpdir = "tmp.test_59779"
+ filename = self.zip_CVE_2017_5977
+ file_url = self.url_CVE_2017_5977
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # TODO
+
url_CVE_2017_5978 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5978 = "00156-zziplib-oobread-zzip_mem_entry_new"
- def test_610_infozipdir_CVE_2017_5978(self):
+ def test_59780_infozipdir_CVE_2017_5978(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_610"
+ tmpdir = "tmp.test_59780"
filename = self.zip_CVE_2017_5978
file_url = self.url_CVE_2017_5978
- trycopy("tmp.test_611", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(' attempt to seek before beginning of zipfile', run.errors)
self.assertLess(len(run.output), 80)
self.assertLess(len(run.errors), 430)
- def test_611_zzipdir_big_CVE_2017_5978(self):
+ def test_59781_zzipdir_big_CVE_2017_5978(self):
""" run info-zip -l $(CVE_2017_5978).zip """
- tmpdir = "tmp.test_611"
+ tmpdir = "tmp.test_59781"
filename = self.zip_CVE_2017_5978
file_url = self.url_CVE_2017_5978
testdir(tmpdir)
- trycopy("tmp.test_610", filename, tmpdir)
- trycopy("tmp.test_612", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored (null)", run.output)
- def test_612_zzipdir_mem_CVE_2017_5978(self):
+ def test_59782_zzipdir_mem_CVE_2017_5978(self):
""" run unzzip-mem -l $(CVE_2017_5978).zip """
- tmpdir = "tmp.test_612"
+ tmpdir = "tmp.test_59782"
filename = self.zip_CVE_2017_5978
file_url = self.url_CVE_2017_5978
testdir(tmpdir)
- trycopy("tmp.test_611", filename, tmpdir)
- trycopy("tmp.test_613", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.errors), 180)
self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
- def test_613_zzipdir_mem_CVE_2017_5978(self):
- """ run unzzip-mem -l $(CVE_2017_5978).zip """
- tmpdir = "tmp.test_613"
+ @unittest.expectedFailure
+ def test_59783_zzipdir_mix_CVE_2017_5978(self):
+ """ run unzzip-mix -l $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59783"
filename = self.zip_CVE_2017_5978
file_url = self.url_CVE_2017_5978
testdir(tmpdir)
- trycopy("tmp.test_612", filename, tmpdir)
- trycopy("tmp.test_614", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 1)
self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
@unittest.expectedFailure
- def test_614_zzipdir_zap_CVE_2017_5978(self):
- """ run unzzip-mix -l $(CVE_2017_5978).zip """
- tmpdir = "tmp.test_614"
+ def test_59784_zzipdir_zap_CVE_2017_5978(self):
+ """ run unzzip -l $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59784"
filename = self.zip_CVE_2017_5978
file_url = self.url_CVE_2017_5978
testdir(tmpdir)
- trycopy("tmp.test_613", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.errors), 180)
self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
+ def test_59785_zipext_info_CVE_2017_5978(self):
+ """ run info' unzip $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59785"
+ filename = self.zip_CVE_2017_5978
+ file_url = self.url_CVE_2017_5978
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [3])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 900)
+ self.assertIn('attempt to seek before beginning of zipfile', run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59786_zzipext_big_CVE_2017_5978(self):
+ """ run unzzip-big $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59786"
+ filename = self.zip_CVE_2017_5978
+ file_url = self.url_CVE_2017_5978
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ def test_59787_zzipext_mem_CVE_2017_5978(self):
+ """ run unzzip-mem $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59787"
+ filename = self.zip_CVE_2017_5978
+ file_url = self.url_CVE_2017_5978
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 300)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ def test_59788_zzipext_mix_CVE_2017_5978(self):
+ """ run unzzip-mix $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59788"
+ filename = self.zip_CVE_2017_5978
+ file_url = self.url_CVE_2017_5978
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 300)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
+ @unittest.expectedFailure
+ def test_59789_zzipext_zap_CVE_2017_5978(self):
+ """ run unzzip $(CVE_2017_5978).zip """
+ tmpdir = "tmp.test_59789"
+ filename = self.zip_CVE_2017_5978
+ file_url = self.url_CVE_2017_5978
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 300)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
url_CVE_2017_5979 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5979 = "00157-zziplib-nullptr-prescan_entry"
- def test_620_infozipdir_CVE_2017_5979(self):
+ def test_59790_infozipdir_CVE_2017_5979(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_620"
+ tmpdir = "tmp.test_59790"
filename = self.zip_CVE_2017_5979
file_url = self.url_CVE_2017_5979
- trycopy("tmp.test_621", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(' 1 file', run.output)
self.assertLess(len(run.output), 330)
self.assertLess(len(run.errors), 1)
- def test_621_zzipdir_big_CVE_2017_5979(self):
+ def test_59791_zzipdir_big_CVE_2017_5979(self):
""" run info-zip -l $(CVE_2017_5979).zip """
- tmpdir = "tmp.test_621"
+ tmpdir = "tmp.test_59791"
filename = self.zip_CVE_2017_5979
file_url = self.url_CVE_2017_5979
testdir(tmpdir)
- trycopy("tmp.test_620", filename, tmpdir)
- trycopy("tmp.test_622", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored a", run.output)
- def test_622_zzipdir_mem_CVE_2017_5979(self):
+ def test_59792_zzipdir_mem_CVE_2017_5979(self):
""" run unzzip-mem -l $(CVE_2017_5979).zip """
- tmpdir = "tmp.test_622"
+ tmpdir = "tmp.test_59792"
filename = self.zip_CVE_2017_5979
file_url = self.url_CVE_2017_5979
testdir(tmpdir)
- trycopy("tmp.test_621", filename, tmpdir)
- trycopy("tmp.test_623", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 a", run.output)
- def test_623_zzipdir_mem_CVE_2017_5979(self):
- """ run unzzip-mem -l $(CVE_2017_5979).zip """
- tmpdir = "tmp.test_623"
+ def test_59793_zzipdir_mix_CVE_2017_5979(self):
+ """ run unzzip-mix -l $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59793"
filename = self.zip_CVE_2017_5979
file_url = self.url_CVE_2017_5979
testdir(tmpdir)
- trycopy("tmp.test_622", filename, tmpdir)
- trycopy("tmp.test_624", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 a", run.output)
- def test_624_zzipdir_zap_CVE_2017_5979(self):
- """ run unzzip-mix -l $(CVE_2017_5979).zip """
- tmpdir = "tmp.test_624"
+ def test_59794_zzipdir_zap_CVE_2017_5979(self):
+ """ run unzzip -l $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59794"
filename = self.zip_CVE_2017_5979
file_url = self.url_CVE_2017_5979
testdir(tmpdir)
- trycopy("tmp.test_623", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 a", run.output)
+ def test_59795_zipext_info_CVE_2017_5979(self):
+ """ run info' unzip $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59795"
+ filename = self.zip_CVE_2017_5979
+ file_url = self.url_CVE_2017_5979
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 1)
+ self.assertIn('extracting: a', run.output)
+ self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
+ def test_59796_zzipext_big_CVE_2017_5979(self):
+ """ run unzzip-big $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59796"
+ filename = self.zip_CVE_2017_5979
+ file_url = self.url_CVE_2017_5979
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
+ @unittest.expectedFailure
+ def test_59797_zzipext_mem_CVE_2017_5979(self):
+ """ run unzzip-mem $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59797"
+ filename = self.zip_CVE_2017_5979
+ file_url = self.url_CVE_2017_5979
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
+ @unittest.expectedFailure
+ def test_59798_zzipext_mix_CVE_2017_5979(self):
+ """ run unzzip-mix $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59798"
+ filename = self.zip_CVE_2017_5979
+ file_url = self.url_CVE_2017_5979
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 20)
+ self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
+ # @unittest.expectedFailure
+ def test_59799_zzipext_zap_CVE_2017_5979(self):
+ """ run unzzip-mix $(CVE_2017_5979).zip """
+ tmpdir = "tmp.test_59799"
+ filename = self.zip_CVE_2017_5979
+ file_url = self.url_CVE_2017_5979
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 20)
+ self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
+
url_CVE_2017_5974 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5974 = "00150-zziplib-heapoverflow-__zzip_get32"
- def test_630_infozipdir_CVE_2017_5974(self):
+ def test_59740_infozipdir_CVE_2017_5974(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_630"
+ tmpdir = "tmp.test_59740"
filename = self.zip_CVE_2017_5974
file_url = self.url_CVE_2017_5974
- trycopy("tmp.test_631", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(' 1 file', run.output)
self.assertLess(len(run.output), 330)
self.assertLess(len(run.errors), 1)
- def test_631_zzipdir_big_CVE_2017_5974(self):
- """ run info-zip -l $(CVE_2017_5974).zip """
- tmpdir = "tmp.test_631"
+ def test_59741_zzipdir_big_CVE_2017_5974(self):
+ """ run unzzip-big -l $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59741"
filename = self.zip_CVE_2017_5974
file_url = self.url_CVE_2017_5974
testdir(tmpdir)
- trycopy("tmp.test_630", filename, tmpdir)
- trycopy("tmp.test_632", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored test", run.output)
- def test_632_zzipdir_mem_CVE_2017_5974(self):
+ def test_59742_zzipdir_mem_CVE_2017_5974(self):
""" run unzzip-mem -l $(CVE_2017_5974).zip """
- tmpdir = "tmp.test_632"
+ tmpdir = "tmp.test_59742"
filename = self.zip_CVE_2017_5974
file_url = self.url_CVE_2017_5974
testdir(tmpdir)
- trycopy("tmp.test_631", filename, tmpdir)
- trycopy("tmp.test_633", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
- def test_633_zzipdir_mem_CVE_2017_5974(self):
- """ run unzzip-mem -l $(CVE_2017_5974).zip """
- tmpdir = "tmp.test_633"
+ @unittest.expectedFailure
+ def test_59743_zzipdir_mix_CVE_2017_5974(self):
+ """ run unzzip-mix -l $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59743"
filename = self.zip_CVE_2017_5974
file_url = self.url_CVE_2017_5974
testdir(tmpdir)
- trycopy("tmp.test_632", filename, tmpdir)
- trycopy("tmp.test_634", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
- def test_634_zzipdir_zap_CVE_2017_5974(self):
- """ run unzzip-mix -l $(CVE_2017_5974).zip """
- tmpdir = "tmp.test_634"
+ def test_59744_zzipdir_zap_CVE_2017_5974(self):
+ """ run unzzip -l $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59744"
filename = self.zip_CVE_2017_5974
file_url = self.url_CVE_2017_5974
testdir(tmpdir)
- trycopy("tmp.test_633", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" 3 test", run.output)
+ def test_59745_zzipext_zip_CVE_2017_5974(self):
+ """ run info' unzip $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59745"
+ filename = self.zip_CVE_2017_5974
+ file_url = self.url_CVE_2017_5974
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 1)
+ self.assertIn(" extracting: test", run.output)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ def test_59746_zzipext_big_CVE_2017_5974(self):
+ """ run unzzip-big $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59746"
+ filename = self.zip_CVE_2017_5974
+ file_url = self.url_CVE_2017_5974
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ @unittest.expectedFailure
+ def test_59747_zzipext_mem_CVE_2017_5974(self):
+ """ run unzzip-mem $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59747"
+ filename = self.zip_CVE_2017_5974
+ file_url = self.url_CVE_2017_5974
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ @unittest.expectedFailure
+ def test_59748_zzipext_mix_CVE_2017_5974(self):
+ """ run unzzip-mix $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59748"
+ filename = self.zip_CVE_2017_5974
+ file_url = self.url_CVE_2017_5974
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ def test_59749_zzipext_zap_CVE_2017_5974(self):
+ """ run unzzip $(CVE_2017_5974).zip """
+ tmpdir = "tmp.test_59749"
+ filename = self.zip_CVE_2017_5974
+ file_url = self.url_CVE_2017_5974
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
url_CVE_2017_5975 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5975 = "00151-zziplib-heapoverflow-__zzip_get64"
- def test_640_infozipdir_CVE_2017_5975(self):
+ def test_59750_infozipdir_CVE_2017_5975(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_640"
+ tmpdir = "tmp.test_59750"
filename = self.zip_CVE_2017_5975
file_url = self.url_CVE_2017_5975
- trycopy("tmp.test_641", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(' 1 file', run.output)
self.assertLess(len(run.output), 330)
self.assertLess(len(run.errors), 430)
- def test_641_zzipdir_big_CVE_2017_5975(self):
+ def test_59751_zzipdir_big_CVE_2017_5975(self):
""" run info-zip -l $(CVE_2017_5975).zip """
- tmpdir = "tmp.test_641"
+ tmpdir = "tmp.test_59751"
filename = self.zip_CVE_2017_5975
file_url = self.url_CVE_2017_5975
testdir(tmpdir)
- trycopy("tmp.test_640", filename, tmpdir)
- trycopy("tmp.test_642", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored test", run.output)
- def test_642_zzipdir_mem_CVE_2017_5975(self):
+ def test_59752_zzipdir_mem_CVE_2017_5975(self):
""" run unzzip-mem -l $(CVE_2017_5975).zip """
- tmpdir = "tmp.test_642"
+ tmpdir = "tmp.test_59752"
filename = self.zip_CVE_2017_5975
file_url = self.url_CVE_2017_5975
testdir(tmpdir)
- trycopy("tmp.test_641", filename, tmpdir)
- trycopy("tmp.test_643", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.errors), 180)
self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
- def test_643_zzipdir_mem_CVE_2017_5975(self):
- """ run unzzip-mem -l $(CVE_2017_5975).zip """
- tmpdir = "tmp.test_643"
+ def test_59753_zzipdir_mix_CVE_2017_5975(self):
+ """ run unzzip-mix -l $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59753"
filename = self.zip_CVE_2017_5975
file_url = self.url_CVE_2017_5975
testdir(tmpdir)
- trycopy("tmp.test_642", filename, tmpdir)
- trycopy("tmp.test_644", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 1)
self.assertLess(len(run.errors), 180)
self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
- def test_644_zzipdir_zap_CVE_2017_5975(self):
- """ run unzzip-mix -l $(CVE_2017_5975).zip """
- tmpdir = "tmp.test_644"
+ def test_59754_zzipdir_zap_CVE_2017_5975(self):
+ """ run unzzip -l $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59754"
filename = self.zip_CVE_2017_5975
file_url = self.url_CVE_2017_5975
testdir(tmpdir)
- trycopy("tmp.test_643", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 1)
self.assertLess(len(run.errors), 180)
self.assertIn(": Success", run.errors)
+ def test_59755_zipext_info_CVE_2017_5975(self):
+ """ run info' unzip $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59755"
+ filename = self.zip_CVE_2017_5975
+ file_url = self.url_CVE_2017_5975
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [2])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 900)
+ self.assertIn('file #1: bad zipfile offset (local header sig): 127', run.errors)
+ #self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ def test_59756_zzipext_big_CVE_2017_5975(self):
+ """ run unzzip-big $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59756"
+ filename = self.zip_CVE_2017_5975
+ file_url = self.url_CVE_2017_5975
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # TODO
+ def test_59757_zzipext_mem_CVE_2017_5975(self):
+ """ run unzzip-mem $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59757"
+ filename = self.zip_CVE_2017_5975
+ file_url = self.url_CVE_2017_5975
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59758_zzipext_mix_CVE_2017_5975(self):
+ """ run unzzip-mix $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59758"
+ filename = self.zip_CVE_2017_5975
+ file_url = self.url_CVE_2017_5975
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59759_zzipext_zap_CVE_2017_5975(self):
+ """ run unzzip $(CVE_2017_5975).zip """
+ tmpdir = "tmp.test_59759"
+ filename = self.zip_CVE_2017_5975
+ file_url = self.url_CVE_2017_5975
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertIn("..(nil)", run.errors)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+
url_CVE_2017_5976 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
zip_CVE_2017_5976 = "00152-zziplib-heapoverflow-zzip_mem_entry_extra_block"
- def test_650_infozipdir_CVE_2017_5976(self):
+ def test_59760_infozipdir_CVE_2017_5976(self):
""" run info-zip dir test0.zip """
- tmpdir = "tmp.test_650"
+ tmpdir = "tmp.test_59760"
filename = self.zip_CVE_2017_5976
file_url = self.url_CVE_2017_5976
- trycopy("tmp.test_651", filename, tmpdir)
testdir(tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzip")
self.assertIn(' 1 file', run.output)
self.assertLess(len(run.output), 330)
self.assertLess(len(run.errors), 500)
- def test_651_zzipdir_big_CVE_2017_5976(self):
+ def test_59761_zzipdir_big_CVE_2017_5976(self):
""" run info-zip -l $(CVE_2017_5976).zip """
- tmpdir = "tmp.test_651"
+ tmpdir = "tmp.test_59761"
filename = self.zip_CVE_2017_5976
file_url = self.url_CVE_2017_5976
testdir(tmpdir)
- trycopy("tmp.test_650", filename, tmpdir)
- trycopy("tmp.test_652", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-big")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn(" stored test", run.output)
- def test_652_zzipdir_mem_CVE_2017_5976(self):
+ def test_59762_zzipdir_mem_CVE_2017_5976(self):
""" run unzzip-mem -l $(CVE_2017_5976).zip """
- tmpdir = "tmp.test_652"
+ tmpdir = "tmp.test_59762"
filename = self.zip_CVE_2017_5976
file_url = self.url_CVE_2017_5976
testdir(tmpdir)
- trycopy("tmp.test_651", filename, tmpdir)
- trycopy("tmp.test_653", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip-mem")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn("3 test", run.output)
- def test_653_zzipdir_mem_CVE_2017_5976(self):
- """ run unzzip-mem -l $(CVE_2017_5976).zip """
- tmpdir = "tmp.test_653"
+ def test_59763_zzipdir_mix_CVE_2017_5976(self):
+ """ run unzzip-mix -l $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59763"
filename = self.zip_CVE_2017_5976
file_url = self.url_CVE_2017_5976
testdir(tmpdir)
- trycopy("tmp.test_652", filename, tmpdir)
- trycopy("tmp.test_654", filename, tmpdir)
download(file_url, filename, tmpdir)
- exe = self.bins("unzzip-mem")
+ exe = self.bins("unzzip-mix")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0])
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn("3 test", run.output)
- def test_654_zzipdir_zap_CVE_2017_5976(self):
- """ run unzzip-mix -l $(CVE_2017_5976).zip """
- tmpdir = "tmp.test_654"
+ def test_59764_zzipdir_zap_CVE_2017_5976(self):
+ """ run unzzip -l $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59764"
filename = self.zip_CVE_2017_5976
file_url = self.url_CVE_2017_5976
testdir(tmpdir)
- trycopy("tmp.test_653", filename, tmpdir)
download(file_url, filename, tmpdir)
exe = self.bins("unzzip")
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
self.assertLess(len(run.output), 30)
self.assertLess(len(run.errors), 1)
self.assertIn("3 test", run.output)
+ def test_59765_zipext_info_CVE_2017_5976(self):
+ """ run info' unzip $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59765"
+ filename = self.zip_CVE_2017_5976
+ file_url = self.url_CVE_2017_5976
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [2])
+ self.assertLess(len(run.output), 190)
+ self.assertLess(len(run.errors), 900)
+ self.assertIn("extracting: test", run.output)
+ self.assertIn('-27 bytes too long', run.errors)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ # self.assertFalse(os.path.exists(tmpdir+"/test"))
+ def test_59766_zzipext_big_CVE_2017_5976(self):
+ """ run unzzip-big $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59766"
+ filename = self.zip_CVE_2017_5976
+ file_url = self.url_CVE_2017_5976
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ def test_59767_zzipext_mem_CVE_2017_5976(self):
+ """ run unzzip-mem $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59767"
+ filename = self.zip_CVE_2017_5976
+ file_url = self.url_CVE_2017_5976
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 30) # TODO
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ @unittest.expectedFailure
+ def test_59768_zzipext_mix_CVE_2017_5976(self):
+ """ run unzzip-mix $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59768"
+ filename = self.zip_CVE_2017_5976
+ file_url = self.url_CVE_2017_5976
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 30) # TODO
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ def test_59769_zzipext_zap_CVE_2017_5976(self):
+ """ run unzzip $(CVE_2017_5976).zip """
+ tmpdir = "tmp.test_59769"
+ filename = self.zip_CVE_2017_5976
+ file_url = self.url_CVE_2017_5976
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 30)
+ self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ url_CVE_2017_5980 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
+ zip_CVE_2017_5980 = "00154-zziplib-nullptr-zzip_mem_entry_new"
+ def test_59800_infozipdir_CVE_2017_5980(self):
+ """ run info-zip dir test0.zip """
+ tmpdir = "tmp.test_59800"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0, 2])
+ self.assertIn(' missing 6 bytes in zipfile', run.errors)
+ self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)
+ self.assertIn(' 1 file', run.output)
+ self.assertLess(len(run.output), 330)
+ self.assertLess(len(run.errors), 500)
+ def test_59801_zzipdir_big_CVE_2017_5980(self):
+ """ run info-zip -l $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59801"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ self.assertIn(" stored (null)", run.output)
+ def test_59802_zzipdir_mem_CVE_2017_5980(self):
+ """ run unzzip-mem -l $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59802"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 180)
+ self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
+ self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
+ @unittest.expectedFailure
+ def test_59803_zzipdir_mix_CVE_2017_5980(self):
+ """ run unzzip-mix -l $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59803"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 180)
+ self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
+ self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
+ def test_59804_zzipdir_zap_CVE_2017_5980(self):
+ """ run unzzip -l $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59804"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0, 255])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 180)
+ self.assertIn(": Success", run.errors)
+ def test_59805_zipext_info_CVE_2017_5980(self):
+ """ run info' unzip $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59805"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [3])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 900)
+ self.assertIn('file #1: bad zipfile offset (lseek)', run.errors)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59806_zzipext_big_CVE_2017_5980(self):
+ """ run unzzip-big $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59806"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ def test_59807_zzipext_mem_CVE_2017_5980(self):
+ """ run unzzip-mem $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59807"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ @unittest.expectedFailure
+ def test_59808_zzipext_mix_CVE_2017_5980(self):
+ """ run unzzip-mix $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59808"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ def test_59809_zzipext_zap_CVE_2017_5980(self):
+ """ run unzzip $(CVE_2017_5980).zip """
+ tmpdir = "tmp.test_59809"
+ filename = self.zip_CVE_2017_5980
+ file_url = self.url_CVE_2017_5980
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [255]) # TODO
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 200)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+
+ url_CVE_2017_5981 = "https://raw.githubusercontent.com/asarubbo/poc/master/"
+ zip_CVE_2017_5981 = "00161-zziplib-assertionfailure-seeko_C"
+ def test_59810_infozipdir_CVE_2017_5981(self):
+ """ run info-zip dir test0.zip """
+ tmpdir = "tmp.test_59810"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0, 3])
+ self.assertIn(' missing 4 bytes in zipfile', run.errors)
+ self.assertIn("zipfile corrupt", run.errors)
+ self.assertLess(len(run.output), 80)
+ self.assertLess(len(run.errors), 500)
+ def test_59811_zzipdir_big_CVE_2017_5981(self):
+ """ run info-zip -l $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59811"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 1)
+ def test_59812_zzipdir_mem_CVE_2017_5981(self):
+ """ run unzzip-mem -l $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59812"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 1)
+ def test_59813_zzipdir_mix_CVE_2017_5981(self):
+ """ run unzzip-mix -l $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59813"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 1)
+ def test_59814_zzipdir_zap_CVE_2017_5981(self):
+ """ run unzzip-zap -l $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59814"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
+ returncodes = [0, 255])
+ self.assertLess(len(run.output), 1)
+ self.assertLess(len(run.errors), 80)
+ self.assertIn(": Success", run.errors)
+ def test_59815_zipext_info_CVE_2017_5981(self):
+ """ run info' unzip $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59815"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzip")
+ run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
+ returncodes = [3])
+ self.assertLess(len(run.output), 90)
+ self.assertLess(len(run.errors), 500)
+ self.assertIn('zipfile corrupt.', run.errors)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ def test_59816_zzipext_big_CVE_2017_5981(self):
+ """ run unzzip-big $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59816"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-big")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 1)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ def test_59817_zzipext_mem_CVE_2017_5981(self):
+ """ run unzzip-mem $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59817"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mem")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 10)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59818_zzipext_mix_CVE_2017_5981(self):
+ """ run unzzip-mix $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59818"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip-mix")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 10)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
+ @unittest.expectedFailure
+ def test_59819_zzipext_zap_CVE_2017_5981(self):
+ """ run unzzip $(CVE_2017_5981).zip """
+ tmpdir = "tmp.test_59819"
+ filename = self.zip_CVE_2017_5981
+ file_url = self.url_CVE_2017_5981
+ testdir(tmpdir)
+ download(file_url, filename, tmpdir)
+ exe = self.bins("unzzip")
+ run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
+ returncodes = [0])
+ self.assertLess(len(run.output), 30)
+ self.assertLess(len(run.errors), 10)
+ # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
+ self.assertFalse(os.path.exists(tmpdir+"/test"))
- def test_800_zzshowme_check_sfx(self):
+ def test_91000_zzshowme_check_sfx(self):
""" create an *.exe that can extract its own zip content """
exe=self.bins("mkzip")
exefile = "tmp.zzshowme" + exeext
txt = open(txtfile).read()
self.assertEqual(txt.split("\n"), run.output.split("\n"))
- def test_900_make_test1w_zip(self):
+ def test_99000_make_test1w_zip(self):
""" create a test1w.zip using zzip/write functions. """
exe=self.bins("zzip")
run = shell("{exe} --version".format(**locals()))
if "- NO -" in run.output:
self.skipTest("- NO -D_ZZIP_ENABLE_WRITE")
return
- zipfile="test1w.zip"
- tmpdir="test1w.tmp"
+ zipfile=self.testzip()
+ tmpdir=self.testdir()
exe=self.bins("zzip")
for i in [1,2,3,4,5,6,7,8,9]:
filename = os.path.join(tmpdir,"file.%i" % i)
filename = os.path.join(tmpdir,"README")
filetext = self.readme()
self.mkfile(filename, filetext)
- try: os.remove(zipfile)
- except: pass
+ self.rm_zipfile()
shell("../{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
self.assertGreater(os.path.getsize(zipfile), 10)