Merge "ZipDirectoryReader: Don't try to parse zero-length files"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 24 Mar 2016 10:38:19 +0000 (10:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 24 Mar 2016 10:38:19 +0000 (10:38 +0000)
includes/utils/ZipDirectoryReader.php

index 44815b4..516e9ae 100644 (file)
@@ -215,6 +215,10 @@ class ZipDirectoryReader {
                        $startPos = 0;
                }
 
+               if ( $this->getFileLength() === 0 ) {
+                       $this->error( 'zip-wrong-format', "The file is empty." );
+               }
+
                $block = $this->getBlock( $startPos );
                $sigPos = strrpos( $block, "PK\x05\x06" );
                if ( $sigPos === false ) {