]> granicus.if.org Git - zziplib/commitdiff
Added test for unzip-mem -v <zipfile containing a directory>
authorJosef Möllers <josef.moellers@suse.com>
Thu, 4 Apr 2019 09:25:00 +0000 (11:25 +0200)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2019 09:25:00 +0000 (11:25 +0200)
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

index 64d3aa85d2ae36028f1826bf3f61b03b3a3c84a8..bba54a0a213815b1c93653188a421821b8caa3c9 100644 (file)
@@ -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")