Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit b5dc409

Browse files
committed
Catch Zip decompression errors.
1 parent dda1830 commit b5dc409

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

core/src/plugins/access.fs/class.fsAccessWrapper.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ protected static function initPath($path, $streamType, $storeOpenContext = false
102102
register_shutdown_function(array("fsAccessWrapper", "removeTmpFile"), $tmpDir, $tmpFileName);
103103
$crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath.$repoObject->resolveVirtualRoots($zipPath)));
104104
$content = $crtZip->listContent();
105-
foreach ($content as $item) {
106-
$fName = AJXP_Utils::securePath($item["stored_filename"]);
107-
if ($fName == $localPath || "/".$fName == $localPath) {
108-
$localPath = $fName;
109-
break;
105+
if(is_array($content)){
106+
foreach ($content as $item) {
107+
$fName = AJXP_Utils::securePath($item["stored_filename"]);
108+
if ($fName == $localPath || "/".$fName == $localPath) {
109+
$localPath = $fName;
110+
break;
111+
}
110112
}
111113
}
112114
$res = $crtZip->extract(PCLZIP_OPT_BY_NAME, $localPath, PCLZIP_OPT_PATH, $tmpDir, PCLZIP_OPT_REMOVE_ALL_PATH);
@@ -125,6 +127,7 @@ protected static function initPath($path, $streamType, $storeOpenContext = false
125127
} else {
126128
$crtZip = new PclZip(AJXP_Utils::securePath($resolvedPath.$repoObject->resolveVirtualRoots($zipPath)));
127129
$liste = $crtZip->listContent();
130+
if(!is_array($liste)) $liste = array();
128131
if($storeOpenContext) self::$crtZip = $crtZip;
129132
$folders = array(); $files = array();$builtFolders = array();
130133
if($localPath[strlen($localPath)-1] != "/") $localPath.="/";

0 commit comments

Comments
 (0)