jenkins-bot has submitted this change and it was merged.
Change subject: ZipDirectoryReader: Don't try to parse zero-length files
......................................................................
ZipDirectoryReader: Don't try to parse zero-length files
With the current code, 'zip-bad' would be returned (eventually). I think
'zip-wrong-format' is a more correct response. This prevents weird errors
when trying to upload such a file (and results in saner errors instead).
Change-Id: Ic2c010f318d98df4783da1cf5126e8dd88aa9014
---
M includes/utils/ZipDirectoryReader.php
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/utils/ZipDirectoryReader.php
b/includes/utils/ZipDirectoryReader.php
index 44815b4..516e9ae 100644
--- a/includes/utils/ZipDirectoryReader.php
+++ b/includes/utils/ZipDirectoryReader.php
@@ -215,6 +215,10 @@
$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 ) {
--
To view, visit https://gerrit.wikimedia.org/r/279316
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2c010f318d98df4783da1cf5126e8dd88aa9014
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits