N°3310 - Fix corrupted backups when a file has a size which is a multiple of 512 bytes

This commit is contained in:
Molkobain
2020-09-28 14:31:36 +02:00
parent 389b61d3a8
commit 794d4f1e0e
7 changed files with 52 additions and 34 deletions

View File

@@ -12,7 +12,7 @@
"ext-soap": "*",
"combodo/tcpdf": "6.3.5",
"nikic/php-parser": "^3.1",
"pear/archive_tar": "1.4.9",
"pear/archive_tar": "1.4.10",
"pelago/emogrifier": "2.1.0",
"scssphp/scssphp": "1.0.6",
"swiftmailer/swiftmailer": "5.4.12",

12
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ad359769d05acd25a9fc31d69acbe43a",
"content-hash": "27af144ea2acf2c138f587052a4ceddc",
"packages": [
{
"name": "combodo/tcpdf",
@@ -168,16 +168,16 @@
},
{
"name": "pear/archive_tar",
"version": "1.4.9",
"version": "1.4.10",
"source": {
"type": "git",
"url": "https://github.com/pear/Archive_Tar.git",
"reference": "c5b00053770e1d72128252c62c2c1a12c26639f0"
"reference": "bbb4f10f71a1da2715ec6d9a683f4f23c507a49b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/c5b00053770e1d72128252c62c2c1a12c26639f0",
"reference": "c5b00053770e1d72128252c62c2c1a12c26639f0",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/bbb4f10f71a1da2715ec6d9a683f4f23c507a49b",
"reference": "bbb4f10f71a1da2715ec6d9a683f4f23c507a49b",
"shasum": ""
},
"require": {
@@ -230,7 +230,7 @@
"archive",
"tar"
],
"time": "2019-12-04T10:17:28+00:00"
"time": "2020-09-15T14:13:23+00:00"
},
{
"name": "pear/console_getopt",

View File

@@ -167,17 +167,17 @@
},
{
"name": "pear/archive_tar",
"version": "1.4.9",
"version_normalized": "1.4.9.0",
"version": "1.4.10",
"version_normalized": "1.4.10.0",
"source": {
"type": "git",
"url": "https://github.com/pear/Archive_Tar.git",
"reference": "c5b00053770e1d72128252c62c2c1a12c26639f0"
"reference": "bbb4f10f71a1da2715ec6d9a683f4f23c507a49b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/c5b00053770e1d72128252c62c2c1a12c26639f0",
"reference": "c5b00053770e1d72128252c62c2c1a12c26639f0",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/bbb4f10f71a1da2715ec6d9a683f4f23c507a49b",
"reference": "bbb4f10f71a1da2715ec6d9a683f4f23c507a49b",
"shasum": ""
},
"require": {
@@ -192,7 +192,7 @@
"ext-xz": "Lzma2 compression support.",
"ext-zlib": "Gzip compression support."
},
"time": "2019-12-04T10:17:28+00:00",
"time": "2020-09-15T14:13:23+00:00",
"type": "library",
"extra": {
"branch-alias": {

View File

@@ -8,3 +8,8 @@ vendor
.buildpath
.project
.settings
# pear
.tarballs
*.tgz
# phpunit
build

View File

@@ -1,6 +1,9 @@
sudo: false
language: php
matrix:
fast_finish: true
allow_failures:
- php: nightly
include:
- php: 5.2
dist: precise
@@ -11,23 +14,12 @@ matrix:
- php: 5.5
dist: trusty
- php: 5.6
dist: trusty
- php: 7.0
dist: trusty
- php: 7.1
dist: trusty
- php: 7.2
dist: trusty
- php: 7.3
dist: trusty
- php: 7.4snapshot
- php: master
jobs:
allow_failures:
- php: 7.4snapshot
- php: master
- php: 7.4
- php: nightly
install:
# - pear upgrade --force --alldeps pear/pear
- pear install -f package.xml

View File

@@ -731,7 +731,7 @@ class Archive_Tar extends PEAR
*/
public function setIgnoreList($list)
{
$regexp = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list);
$list = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list);
$regexp = '#/' . join('$|/', $list) . '#';
$this->setIgnoreRegexp($regexp);
}
@@ -1273,7 +1273,7 @@ class Archive_Tar extends PEAR
while (($v_buffer = fread($v_file, $this->buffer_length)) != '') {
$buffer_length = strlen("$v_buffer");
if ($buffer_length != $this->buffer_length) {
$pack_size = ((int)($buffer_length / 512) + 1) * 512;
$pack_size = ((int)($buffer_length / 512) + ($buffer_length % 512 !== 0 ? 1 : 0)) * 512;
$pack_format = sprintf('a%d', $pack_size);
} else {
$pack_format = sprintf('a%d', $this->buffer_length);
@@ -1515,8 +1515,13 @@ class Archive_Tar extends PEAR
$userinfo = posix_getpwuid($p_uid);
$groupinfo = posix_getgrgid($p_gid);
$v_uname = $userinfo['name'];
$v_gname = $groupinfo['name'];
if ($userinfo === false || $groupinfo === false) {
$v_uname = '';
$v_gname = '';
} else {
$v_uname = $userinfo['name'];
$v_gname = $groupinfo['name'];
}
} else {
$v_uname = '';
$v_gname = '';

View File

@@ -32,10 +32,10 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
<email>stig@php.net</email>
<active>no</active>
</helper>
<date>2019-12-04</date>
<time>09:25:16</time>
<date>2020-09-15</date>
<time>14:03:45</time>
<version>
<release>1.4.9</release>
<release>1.4.10</release>
<api>1.4.0</api>
</version>
<stability>
@@ -44,7 +44,8 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
* Implement Feature #23861: Add option to disallow symlinks [mrook]
* Fix block padding when the file buffer length is a multiple of 512 and smaller than Archive_Tar buffer length
* Don't try to copy username/groupname in chroot jail
</notes>
<contents>
<dir name="/">
@@ -74,6 +75,21 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
</dependencies>
<phprelease />
<changelog>
<release>
<version>
<release>1.4.9</release>
<api>1.4.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2019-12-04</date>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
* Implement Feature #23861: Add option to disallow symlinks [mrook]
</notes>
</release>
<release>
<version>
<release>1.4.8</release>