Skip to content

Commit acb966f

Browse files
committed
refined chr fix
1 parent b1202a6 commit acb966f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Smalot/PdfParser/RawData/FilterHelper.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ protected function decodeFilterASCII85Decode(string $data): string
212212
$chr24Part = \chr($tuple >> 24);
213213
}
214214

215-
$decoded .= $chr24Part
216-
. $chr16Part
217-
. $chr8Part
218-
.\chr($tuple);
215+
if (255 < $tuple) {
216+
$chrTuple = \chr($tuple % 256);
217+
} else {
218+
$chrTuple = \chr($tuple);
219+
}
220+
221+
$decoded .= $chr24Part . $chr16Part . $chr8Part . $chrTuple;
219222
$tuple = 0;
220223
$group_pos = 0;
221224
} else {

0 commit comments

Comments
 (0)