This repository was archived by the owner on Jan 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,18 @@ public function canRead($pFilename)
269269 */
270270 public function securityScan ($ xml )
271271 {
272+ $ pattern = '/encoding="(.*?)"/ ' ;
273+ $ result = preg_match ($ pattern , $ xml , $ matches );
274+ if ($ result ) {
275+ $ charset = $ matches [1 ];
276+ } else {
277+ $ charset = 'UTF-8 ' ;
278+ }
279+
280+ if ($ charset !== 'UTF-8 ' ) {
281+ $ xml = mb_convert_encoding ($ xml , 'UTF-8 ' , $ charset );
282+ }
283+
272284 $ pattern = '/ \\0? ' . implode ('\\0? ' , str_split ('<!DOCTYPE ' )) . '\\0?/ ' ;
273285 if (preg_match ($ pattern , $ xml )) {
274286 throw new PHPExcel_Reader_Exception ('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks ' );
Original file line number Diff line number Diff line change 2323**************************************************************************************
2424
2525
26- Planned for 1.8.2
26+ 2018-11-22 (v1.8.2):
27+ - Security (MBaker) - Fix and improve XXE security scanning for XML-based Readers
2728- Bugfix: (MBaker) - Fix to getCell() method when cell reference includes a worksheet reference
2829- Bugfix: (ncrypthic) Work Item GH-570 - Ignore inlineStr type if formula element exists
2930- Bugfix: (hernst42) Work Item GH-709 - Fixed missing renames of writeRelationShip (from _writeRelationShip)
You can’t perform that action at this time.
0 commit comments