diff --git a/src/Smalot/PdfParser/RawData/RawDataParser.php b/src/Smalot/PdfParser/RawData/RawDataParser.php index 6b04fae5..7b43305f 100644 --- a/src/Smalot/PdfParser/RawData/RawDataParser.php +++ b/src/Smalot/PdfParser/RawData/RawDataParser.php @@ -408,10 +408,15 @@ protected function decodeXrefStream(string $pdfData, int $startxref, array $xref } else { // number of bytes in a row $rowlen = array_sum($wb); - // convert the stream into an array of integers - $sdata = unpack('C*', $xrefcrs[1][3][0]); - // split the rows - $ddata = array_chunk($sdata, $rowlen); + if (0 < $rowlen) { + // convert the stream into an array of integers + $sdata = unpack('C*', $xrefcrs[1][3][0]); + // split the rows + $ddata = array_chunk($sdata, $rowlen); + } else { + // if the row length is zero, $ddata should be an empty array as well + $ddata = []; + } } $sdata = [];