From 0b286ce6ac3575a2186011d21a18c8dcabe2a8bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Josef=20M=C3=B6llers?= Date: Thu, 4 Apr 2019 11:25:00 +0200 Subject: [PATCH] Added test for unzip-mem -v When verbously listing a compressed zipfile containing a directory using unzip-mem, a division-by-zero is performed. This bug was fixed and the test checks for this. --- test/zziptests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/zziptests.py b/test/zziptests.py index 64d3aa8..bba54a0 100644 --- a/test/zziptests.py +++ b/test/zziptests.py @@ -3429,6 +3429,26 @@ class ZZipTest(unittest.TestCase): self.assertTrue(os.path.exists(workdir+"/test/evil.conf")) self.rm_testdir() + def test_65485_list_verbose_compressed_with_directory(self): + """ verbously list a zipfile containing directories """ + tmpdir = self.testdir() + workdir = tmpdir + "/d" + zipname = "ZIPfile" + os.makedirs(workdir) + f= open(tmpdir + "/d/file","w+") + for i in range(10): + f.write("This is line %d\r\n" % (i+1)) + f.close() + # create the ZIPfile + exe=self.bins("zzip") + run = shell("chdir {tmpdir} && ../{exe} -9 {zipname}.zip d".format(**locals())) + self.assertFalse(run.returncode) + # list the ZIPfile + exe=self.bins("unzip-mem"); + run = shell("chdir {tmpdir} && ../{exe} -v {zipname}.zip".format(**locals())) + self.assertFalse(run.returncode) + self.rm_testdir() + def test_91000_zzshowme_check_sfx(self): """ create an *.exe that can extract its own zip content """ exe=self.bins("mkzip") -- 2.40.0