Skip to content

Commit

Permalink
Fix bug Allowed memory size exhausted on Font.php line 150 smalot#735
Browse files Browse the repository at this point in the history
  • Loading branch information
creasitenet committed Feb 9, 2025
1 parent 0ddcc54 commit f25e210
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Smalot/PdfParser/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ public function loadTranslateTable(): array
if (preg_match_all('/beginbfrange(?P<sections>.*?)endbfrange/s', $content, $matches)) {
foreach ($matches['sections'] as $section) {
// Support for : <srcCode1> <srcCode2> <dstString>
$regexp = '/<(?P<from>[0-9A-F]+)> *<(?P<to>[0-9A-F]+)> *<(?P<offset>[0-9A-F]+)>[ \r\n]+/is';

// $regexp = '/<(?P<from>[0-9A-F]+)> *<(?P<to>[0-9A-F]+)> *<(?P<offset>[0-9A-F]+)>[ \r\n]+/is';
$regexp = '/<(?P<from>[0-9A-F]+)> *<(?P<to>[0-9A-F]+)> *<(?P<offset>[0-9A-F]+)>? *[\r\n]+/is';

preg_match_all($regexp, $section, $matches);

foreach ($matches['from'] as $key => $from) {
Expand Down

0 comments on commit f25e210

Please sign in to comment.