Fix infinite loop when reading invalid ODS files

According to the spec, http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415588_253892949,
a `<table:table-row>` can only ever contains a `<table:table-cell>` or
a `<table:covered-table-cell>`, but it seems that some invalid files in the wild
may contains something else. That would trigger an infinite loop. So instead we
totally ignore the invalid content.

Closes #832
This commit is contained in:
Kirill Petrov 2018-12-26 12:57:01 +04:00 committed by Adrien Crivelli
parent 86c635b3f5
commit 39b573b29d
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 3 additions and 0 deletions

View File

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
- Improved performance when loading large spreadsheets - [#825](https://github.com/PHPOffice/PhpSpreadsheet/pull/825) - Improved performance when loading large spreadsheets - [#825](https://github.com/PHPOffice/PhpSpreadsheet/pull/825)
- Improved performance when loading large spreadsheets - [#824](https://github.com/PHPOffice/PhpSpreadsheet/pull/824) - Improved performance when loading large spreadsheets - [#824](https://github.com/PHPOffice/PhpSpreadsheet/pull/824)
- Fix color from CSS when reading from HTML - [#831](https://github.com/PHPOffice/PhpSpreadsheet/pull/831) - Fix color from CSS when reading from HTML - [#831](https://github.com/PHPOffice/PhpSpreadsheet/pull/831)
- Fix infinite loop when reading invalid ODS files - [#832](https://github.com/PHPOffice/PhpSpreadsheet/pull/832)
## [1.5.2] - 2018-11-25 ## [1.5.2] - 2018-11-25

View File

@ -210,6 +210,8 @@ class Ods extends BaseReader
$mergeSize = $xml->getAttribute('table:number-columns-repeated'); $mergeSize = $xml->getAttribute('table:number-columns-repeated');
$currCells += (int) $mergeSize; $currCells += (int) $mergeSize;
$xml->read(); $xml->read();
} else {
$xml->read();
} }
} while ($xml->name != 'table:table-row'); } while ($xml->name != 'table:table-row');
} }