diff options
| -rw-r--r-- | generic/tclZipfs.c | 4 | ||||
| -rw-r--r-- | tests/zipfs.test | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 2297e79..248732b 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -225,14 +225,14 @@ typedef struct ZipEntry { int numCompressedBytes; /* Compressed size of the virtual file. -1 for zip64 */ int compressMethod; /* Compress method */ - int isDirectory; /* Set to 1 if directory, or -1 if root */ + int isDirectory; /* 0 if file, 1 if directory, -1 if root */ int depth; /* Number of slashes in path. */ int crc32; /* CRC-32 as stored in ZIP */ int timestamp; /* Modification time */ int isEncrypted; /* True if data is encrypted */ int flags; #define ZE_F_CRC_COMPARED 0x1 /* If 1, the CRC has been compared. */ -#define ZE_F_CRC_CORRECT 0x2 /* Only meaningful if ZE_F_CRC_CHECKED is 1 */ +#define ZE_F_CRC_CORRECT 0x2 /* Only meaningful if ZE_F_CRC_COMPARED is 1 */ unsigned char *data; /* File data if written */ struct ZipEntry *next; /* Next file in the same archive */ struct ZipEntry *tnext; /* Next top-level dir in archive */ diff --git a/tests/zipfs.test b/tests/zipfs.test index 6c0870e..11fd306 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -40,6 +40,8 @@ if {![string match ${ziproot}* $tcl_library]} { ### set tclzip [file join $CWD libtcl[info patchlevel].zip] testConstraint zipfslib [file isfile $tclzip] + puts C:[testConstraint zipfslib],$tclzip,$tcl_library + parray ::env TCL* if {[testConstraint zipfslib]} { zipfs mount $tclzip /lib/tcl set ::tcl_library ${ziproot}lib/tcl/tcl_library @@ -1007,6 +1009,18 @@ namespace eval test_ns_zipfs { testcrc local incons-local-crc.zip a "invalid CRC" testcrc store-crc broken.zip storedcrcerror "invalid CRC" testcrc deflate-crc broken.zip deflatecrcerror "invalid CRC" + test zipfs-crc-false-positives { + Verify no false positives in CRC checking + } -constraints zipfslib -body { + # Just loop ensuring no crc failures + foreach f [zipfs list] { + if {[file isfile $f]} { + close [open $f] + incr count + } + } + expr {$count > 0} + } -result 1 # # file stat |
