test_corrupt_1211262.js (737B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ 3 */ 4 5 // Regression test ensuring that that a STORED entry with differing compressed 6 // and uncompressed sizes is considered to be corrupt. 7 function run_test() { 8 var file = do_get_file("data/test_corrupt3.zip"); 9 10 var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance( 11 Ci.nsIZipReader 12 ); 13 zipreader.open(file); 14 15 var failed = false; 16 for (let entryPath of zipreader.findEntries("*")) { 17 let entry = zipreader.getEntry(entryPath); 18 if (!entry.isDirectory) { 19 try { 20 zipreader.getInputStream(entryPath); 21 } catch (e) { 22 failed = true; 23 } 24 } 25 } 26 27 Assert.ok(failed); 28 }