Skip to content

Commit

Permalink
Fix infinite loop when reading invalid ODS files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Krakozaber authored and PowerKiKi committed Jan 2, 2019
1 parent 86c635b commit 39b573b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - [#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 infinite loop when reading invalid ODS files - [#832](https://github.com/PHPOffice/PhpSpreadsheet/pull/832)

## [1.5.2] - 2018-11-25

Expand Down
2 changes: 2 additions & 0 deletions src/PhpSpreadsheet/Reader/Ods.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ public function listWorksheetInfo($pFilename)
$mergeSize = $xml->getAttribute('table:number-columns-repeated');
$currCells += (int) $mergeSize;
$xml->read();
} else {
$xml->read();
}
} while ($xml->name != 'table:table-row');
}
Expand Down

0 comments on commit 39b573b

Please sign in to comment.