Skip to content

Commit

Permalink
Merge branch 'hotfix/3.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne-Lexa committed Oct 30, 2017
2 parents 183274d + 115dfd3 commit 810b7ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"minimum-stability": "stable",
"require": {
"php-64bit": "^5.5 || ^7.0"
"php": "^5.5 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions src/PhpZip/Model/Entry/ZipAbstractEntry.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace PhpZip\Model\Entry;

use PhpZip\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -257,6 +258,7 @@ public function getCompressedSize()
public function setCompressedSize($compressedSize)
{
if (self::UNKNOWN != $compressedSize) {
$compressedSize = sprintf('%u', $compressedSize);
if (0 > $compressedSize || $compressedSize > 0x7fffffffffffffff) {
throw new ZipException("Compressed size out of range - " . $this->name);
}
Expand Down Expand Up @@ -285,6 +287,7 @@ public function getSize()
public function setSize($size)
{
if (self::UNKNOWN != $size) {
$size = sprintf('%u', $size);
if (0 > $size || $size > 0x7fffffffffffffff) {
throw new ZipException("Uncompressed Size out of range - " . $this->name);
}
Expand All @@ -310,6 +313,7 @@ public function getOffset()
*/
public function setOffset($offset)
{
$offset = sprintf('%u', $offset);
if (0 > $offset || $offset > 0x7fffffffffffffff) {
throw new ZipException("Offset out of range - " . $this->name);
}
Expand Down Expand Up @@ -523,6 +527,7 @@ public function getDosTime()
*/
public function setDosTime($dosTime)
{
$dosTime = sprintf('%u', $dosTime);
if (0x00000000 > $dosTime || $dosTime > 0xffffffff) {
throw new ZipException('DosTime out of range');
}
Expand Down Expand Up @@ -554,6 +559,7 @@ public function setExternalAttributes($externalAttributes)
{
$known = self::UNKNOWN != $externalAttributes;
if ($known) {
$externalAttributes = sprintf('%u', $externalAttributes);
if (0x00000000 > $externalAttributes || $externalAttributes > 0xffffffff) {
throw new ZipException("external file attributes out of range - " . $this->name);
}
Expand Down Expand Up @@ -847,6 +853,7 @@ public function getCrc()
*/
public function setCrc($crc)
{
$crc = sprintf('%u', $crc);
if (0x00000000 > $crc || $crc > 0xffffffff) {
throw new ZipException("CRC-32 out of range - " . $this->name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/PhpZip/Model/Entry/ZipNewEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function writeEntry($outputStream)
} else {
fwrite($outputStream, pack('VV', $this->getCompressedSize(), $this->getSize()));
}
} elseif ($this->getCompressedSize() !== $compressedSize) {
} elseif ($this->getCompressedSize() != $compressedSize) {
throw new ZipException($this->getName()
. " (expected compressed entry size of "
. $this->getCompressedSize() . " bytes, but is actually " . $compressedSize . " bytes)");
Expand Down

0 comments on commit 810b7ca

Please sign in to comment.