Skip to content

Commit

Permalink
added a test to exploit #659
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni committed Mar 13, 2024
1 parent ca3fea6 commit 723efe2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/PHPUnit/Integration/RawData/FilterHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ public function testDecodeFilterFlateDecodeCRC32Checksum(): void
self::assertStringContainsString('Two Westbrook Corporate Center Suite 500', $document->getText());
}

/**
* Check if function runs into a "gzuncompress(): data error".
*
* @see https://github.com/smalot/pdfparser/issues/659
*/
public function testDecodeFilterFlateDecodeGzUncompressDataErrorIssue659(): void
{
$data = '�s��8�S4z�2A�ٮ�������n�O��)q,�ӕ�ik�7l�B:��<Lgz?��C�/�UL�"XZ�@���ui~-�����٥~�&K��"&8_�E����A�f
***@***.***�Kj��s����!3�Q�<�������#
ŀ>�����3�|�L';

$subjectUnderTest = new FilterHelper();

// ,--- currently throws exception: decodeFilterFlateDecode: invalid data
// ,
// ,
$subjectUnderTest->decodeFilter('FlateDecode', $data, 1000000);

// we expect an error with "gzuncompress(): data error" here
}

/**
* How does function behave if an unknown filter name was given.
*/
Expand Down

0 comments on commit 723efe2

Please sign in to comment.