Skip to content

Commit 6e66f00

Browse files
committed
Fix "Argument 3 ($offset) must be contained in argument 2 ($data)"
Discovered when integration-testing with the official test data from https://github.com/google/snappy/tree/main/testdata
1 parent 6474a4e commit 6e66f00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/php/io/streams/compress/Snappy.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function compress(string $data, $options= null): string {
9696
$hash= $next;
9797
$forward+= ($skip & 0xffffffff) >> 5;
9898
$skip++;
99-
if ($pos > $limit) goto emit;
99+
if ($pos > $limit || $forward > $limit) goto emit;
100100

101101
$next= ((unpack('V', $data, $forward)[1] * self::HASH_KEY) & 0xffffffff) >> $shift;
102102
$candidate= $start + $hashtable[$hash];

0 commit comments

Comments
 (0)